[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

openoffice wrapper (again)



Hi!

As seen in Bug#173067, help doesn't work if LANG is not en_US. (In fact,
it is in english or unavailable if openoffice.org-help-en isn't
installed)
Diffs to the current openoffice wrapper to make it work again are
attached.

For curious people, here are some explanations.
Some tests with the following packages installed:

ii  openoffice.org                               1.0.1-6
ii  openoffice.org-bin                           1.0.1-6
ii  openoffice.org-debian-files                  1.0.1-6+5
ii  openoffice.org-help-en                       1.0.1-6
ii  openoffice.org-help-fr                       0.20020222-2
ii  openoffice.org-l10n-en                       1.0.1-6
ii  openoffice.org-l10n-fr                       1.0.1-6
ii  openoffice.org-spellcheck-fr-fr              20020727-2

en_US and fr_FR locales are supported on my system.

tests started with: LANG=??_?? ~/.openoffice/1.0.1/soffice

LANG	ooLocale	UI	help
fr_FR	<ooLocale/>	fr	en
en_US	<ooLocale/>	en	en
fr_FR	fr-FR		fr	fr
en_US	fr-FR		fr	fr
fr_FR	fr-XX		fr	fr
en_US	fr-XX		fr	fr
fr_FR	fr		fr	fr
en_US	fr		fr	fr
fr_FR	fr_FR		fr	fr
en_US	fr_FR		en	fr

If I remove the openoffice.org-help-en package:
LANG    ooLocale        UI	help
fr_FR   <ooLocale/>	fr	unavailable
en_US   <ooLocale/>	en	unavailable

If I remove the openoffice.org-l10n-en package:
LANG    ooLocale        UI      help
fr_FR   <ooLocale/>     fr      unavailable
en_US	startup failed with error message: Application ErrorAbandon

As a conclusion:
 - the short term solution for the debian openoffice wrapper seems to be to
 set ooLocale acording to LANG on each startup.
 - UI language and Help language are both determined from the value of the
ooLocale key, but not exactly in the same way.

(Hey Chris, didn't you write in a previous mail "This behaviour seems a little
odd.  I wonder if it is really intended to be like that in OOo?" I wonder
too ...)

A final note: I noticed that on Windows, the french version of openoffice
comes with ooLocale set to fr (not fr-FR, ...). I didn't try to cut LANG
to retain the first 2 characters because I expected problems asian
locales. However, with western languages, I think it would be OK.

Lucien.
*** /usr/bin/openoffice	2002-12-09 16:29:01.000000000 +0100
--- openoffice	2002-12-16 10:35:42.000000000 +0100
***************
*** 81,86 ****
--- 81,106 ----
  SAL_FONTPATH_USER=${SAL_FONTPATH_USER:-"$DEBOO_FONTPATH"}
  export SAL_FONTPATH_USER
  
+ ## search LOCALE
+ if [ -n "$LC_ALL" ]; then
+   LOCALE="$LC_ALL"
+   # OOo doesn't understand LC_ALL, so set LANG
+   LANG="$LC_ALL"
+ elif [ -n "$LANG" ]; then
+   LOCALE="$LANG"
+ elif [ -n "$LC_MESSAGES" ]; then
+   LOCALE="$LC_MESSAGES"
+   LANG="$LC_MESSAGES"
+ else
+   LOCALE="en_US"
+ fi
+ 
+ # Set locale to en_US if locale is C
+ if [ "x$LOCALE" = "xC" ] ; then LOCALE="en_US"; fi
+ 
+ LOCALEOO=`echo $LOCALE | sed 's/_/-/'`
+ 
+ 
  ##
  ## install OO for this user if needed
  ##
***************
*** 111,117 ****
      mv $SETUPFILE $SETUPFILE.tmp
  
      # Set ooLocale to nothing in $SETUPFILE. The UI language is handled by LANG.
!     # Not having ooLocale at all defaults to en_US
      cat $SETUPFILE.tmp | \
        perl -e "while (<>) { /<Office>/ && print \" <L10N>\n  <ooLocale cfg:type=\\\"string\\\"/>\n </L10N>\n\";print \$_;}" > \
        $SETUPFILE
--- 131,137 ----
      mv $SETUPFILE $SETUPFILE.tmp
  
      # Set ooLocale to nothing in $SETUPFILE. The UI language is handled by LANG.
!     # A goog value for ooLocale will be set before starting.
      cat $SETUPFILE.tmp | \
        perl -e "while (<>) { /<Office>/ && print \" <L10N>\n  <ooLocale cfg:type=\\\"string\\\"/>\n </L10N>\n\";print \$_;}" > \
        $SETUPFILE
***************
*** 146,175 ****
  ## Previous dead installation?
  [ -d $HOME/.openoffice/user ] && echo "Warning: you have a user settings directory from 1.0.0 in ~/.openoffice/user - this is no longer used"
  
  ##
  ## That's it. Launch the beast (with the given args)
  ##
- if [ -n "$LC_ALL" ]; then
-   LOCALE="$LC_ALL"
-   # OOo doesn't understand LC_ALL, so set LANG
-   LANG="$LC_ALL"
- elif [ -n "$LANG" ]; then
-   LOCALE="$LANG"
- elif [ -n "$LC_MESSAGES" ]; then
-   LOCALE="$LC_MESSAGES"
-   LANG="$LC_MESSAGES"
- else
-   LOCALE="en_US"
- fi
- 
- # Set locale to en-US if locale is C
- if [ "x$LOCALE" = "xC" ] ; then LOCALE="en_US"; fi
- 
  LANG=$LOCALE
  export LANG
  exec "$OOHOME/soffice" "$@"
  
  ## Changelog
  # 12/03 challs
  #   * Add Debian font paths to user font path
  # 11/14 saviot
--- 166,190 ----
  ## Previous dead installation?
  [ -d $HOME/.openoffice/user ] && echo "Warning: you have a user settings directory from 1.0.0 in ~/.openoffice/user - this is no longer used"
  
+ ## Change the ooLocale key in SETUPFILE acording to LOCALE
+ SETUPFILE="$OOHOME/user/config/registry/instance/org/openoffice/Setup.xml"
+ mv $SETUPFILE $SETUPFILE.tmp
+ cat $SETUPFILE.tmp | \
+   sed 's#<ooLocale[^/]*/[^>]*>#<ooLocale cfg:type="string">'$LOCALEOO'</ooLocale>#'\
+   > $SETUPFILE
+ rm -f $SETUPFILE.tmp
+ 
  ##
  ## That's it. Launch the beast (with the given args)
  ##
  LANG=$LOCALE
  export LANG
  exec "$OOHOME/soffice" "$@"
  
  ## Changelog
+ # 12/15 saviot
+ #   * Change ooLocale at startup in Setup.xml
+ #   <ooLocale cfg:type="string"/> doesn't work for help.
  # 12/03 challs
  #   * Add Debian font paths to user font path
  # 11/14 saviot

Reply to: