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

got OOo in french !



Hello,

I've got OOo runing in french.
For that, you have to:

1) extract a bunch of resources in /usr/lib/openoffice/program/resource/
2) edit some config files in ~/.openoffice

The attached version of /usr/bin/openoffice can do the 2) automatically.
Here is how it works:
- I add a file ~/.openoffice/lang.debian containing the locale for which it is
  configured for now (defaulting to en-US when not found).
- then, each time openoffice is launched, it compares the actual locale to
  the one found in this file. If changed, it updates the needed config files.
- You have to change 3 files to remplace all occurence of the old local to
  the new one:
  ~/.openoffice/instdb.ins
  ~/.openoffice/user/config/registry/instance/org/openoffice/Office/Linguistic.xml
  .openoffice/user/config/registry/instance/org/openoffice/Setup.xml
  (you may have to create the second one if it does not exist, and add a
   L10N section in the third one)
- obviously put the new locale in ~/.openoffice/lang.debian

That's it. It works like that. If the locale is not installed (ie, if step 1
is not done), OOo falls back to english gracefully.

The next problem to tackle is the generation of resources. For now, I
extracted manually the files from a french installer. That's quite annoying.
I have a build runing, I asked to build all languages, I'll see if it works,
and then, I'll build separate .deb from theses resources.

You need perl to have this script running (a small part was too hard in sed,
and I don't speak awk).

Last point, the script also unset SESSION_MANAGER before calling soffice, it
will solve my problems with the gnome session manager.

Enjoy, Mt.

-- 
Dans un pays d'extrême droite, la justice porte le képi.
Peine de mort au coin de la rue.
   -- Frères misère
#!/bin/sh
#
# Wrapper script for openoffice
#
# (C) Peter 'Nidd' Novodvorsky, 2001.
# (C) Martin 'empty' Quinson, 2002.

# This program is free software; you can redistribute it and/or modify         
# it under the terms of the GNU General Public License as published by         
# the Free Software Foundation; either version 2 of the License, or            
# (at your option) any later version.                                          
#                                                                             
# This program is distributed in the hope that it will be useful,              
# but WITHOUT ANY WARRANTY; without even the implied warranty of               
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU             
# General Public License for more details.                                     
#                                                                             
# You should have received a copy of the GNU General Public License            
# along with this program; if not, write to the Free Software                  
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA      
                                                                             
if [ ! -d ~/.openoffice ]; then
  /usr/lib/openoffice/program/setup -R:/etc/openoffice/autoresponse.conf
fi 
# Search the right locale
if [ -e ~/.openoffice/lang.debian ] ; then
  OLDLOCALE=`cat ~/.openoffice/lang.debian`
else
  OLDLOCALE="en-US"
fi
LOCALE="$LC_ALL"
if [ -z $LOCALE ] ; then LOCALE="$LC_MESSAGES"; fi
if [ -z $LOCALE ] ; then LOCALE="$LANG"; fi
if [ -z $LOCALE ] ; then LOCALE="en-US"; fi
if [ "$LOCALE" != "$OLDLOCALE" ] ; then 
  
  # Change instdb.ins
  cp ~/.openoffice/instdb.ins ~/.openoffice/instdb.ins.$OLDLOCALE
  sed "s/>$OLDLOCALE</>$LOCALE</" ~/.openoffice/instdb.ins.$OLDLOCALE > ~/.openoffice/instdb.ins
  
  # Create Linguistic.xml if don't exists
  if [ ! -e .openoffice/user/config/registry/instance/org/openoffice/Office/Linguistic.xml.$OLDLOCALE ] ; then
     cat >.openoffice/user/config/registry/instance/org/openoffice/Office/Linguistic.xml.tmp <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<Linguistic state="modified" cfg:package="org.openoffice.Office" xmlns="http://openoffice.org/2000/registry/components/Linguistic"; xmlns:cfg="http://openoffice.org/2000/registry/instance"; xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance";>
 <General>
  <DefaultLocale cfg:type="string">en-US</DefaultLocale>
 </General>
</Linguistic>
EOF
      sed "s/>en-US</>$OLDLOCALE</" .openoffice/user/config/registry/instance/org/openoffice/Office/Linguistic.xml.tmp > \
                                    .openoffice/user/config/registry/instance/org/openoffice/Office/Linguistic.xml.$OLDLOCALE
      rm .openoffice/user/config/registry/instance/org/openoffice/Office/Linguistic.xml.tmp			
  fi # Linguistic.xml does not exist
  # change Linguistic.xml
  sed "s/>$OLDLOCALE</>$LOCALE</" .openoffice/user/config/registry/instance/org/openoffice/Office/Linguistic.xml.$OLDLOCALE > \
                                  .openoffice/user/config/registry/instance/org/openoffice/Office/Linguistic.xml

  # Change Setup.xml
  if grep -q '<ooLocale cfg:type' .openoffice/user/config/registry/instance/org/openoffice/Setup.xml ; then 
    cp .openoffice/user/config/registry/instance/org/openoffice/Setup.xml \
       .openoffice/user/config/registry/instance/org/openoffice/Setup.xml.$OLDLOCALE
    sed "s/>$OLDLOCALE</>$LOCALE</" .openoffice/user/config/registry/instance/org/openoffice/Setup.xml.$OLDLOCALE > \
                                    .openoffice/user/config/registry/instance/org/openoffice/Setup.xml
  else # ooLocale entry does not exists in Setup.xml
    cp .openoffice/user/config/registry/instance/org/openoffice/Setup.xml \
       .openoffice/user/config/registry/instance/org/openoffice/Setup.xml.tmp
     
    cat .openoffice/user/config/registry/instance/org/openoffice/Setup.xml.tmp | \
      perl -e "while (<>) { /<Office>/ && print \"<L10N>\n<ooLocale cfg:type=\\\"string\\\">$LOCALE</ooLocale>\n</L10N>\n\";print $_;}" > \
      .openoffice/user/config/registry/instance/org/openoffice/Setup.xml
    rm .openoffice/user/config/registry/instance/org/openoffice/Setup.xml.tmp
  fi # change Setup.xml
  
  echo "$LOCALE" > ~/.openoffice/lang.debian
fi # LOCALE != OLDLOCALE


unset SESSION_MANAGER
~/.openoffice/soffice

Reply to: