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

Re: got OOo in french !

well, i should send this to the list, not myself :(

----- Forwarded message from Martin Quinson <Martin.Quinson@tuxfamily.org> -----

Date: Thu, 16 May 2002 11:09:17 +0200
To: Martin Quinson <Martin.Quinson@tuxfamily.org>
Subject: Re: got OOo in french !
From: Martin Quinson <Martin.Quinson@tuxfamily.org>


Chating about that on IRC, haggai told me that the script would be easier to
read if I did not use the whole paths every time, but if I used some
variable to make it shorter.

So did I. 

Bye, Mt.

On Thu, May 16, 2002 at 10:10:19AM +0200, Martin Quinson wrote:
> 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.
# 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               
# 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

# Fix some variable to make the paths shorter in the rest

# Search the right locale
if [ -e $oohome/lang.debian ] ; then
  OLDLOCALE=`cat $oohome/lang.debian`
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 $oohome/instdb.ins $oohome/instdb.ins.$OLDLOCALE
  sed "s/>$OLDLOCALE</>$LOCALE</" $oohome/instdb.ins.$OLDLOCALE > $oohome/instdb.ins
  # Create Linguistic.xml if don't exists
  if [ ! -e $lingfile.$OLDLOCALE ] ; then
     cat >$lingfile.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";>
  <DefaultLocale cfg:type="string">en-US</DefaultLocale>
      sed "s/>en-US</>$OLDLOCALE</" $lingfile.tmp > $lingfile.$OLDLOCALE
      rm $lingfile.tmp
  fi # Linguistic.xml does not exist
  # change Linguistic.xml
  sed "s/>$OLDLOCALE</>$LOCALE</" $lingfile.$OLDLOCALE > $lingfile

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


Reply to: