PDA

View Full Version : Language pack PBI for OpenOffice.org


antik
07-20-2006, 07:52 AM
To cut down work related to building huge amount of localised versions of OOo PBIs we decided to ship only one "large" (~100MB) OpenOffice PBI in english and all other languages release as downloadable add-on's (~13MB). I made estonian version of language pack with speller and hypernation but I am too lazy to create more than 50+ different ones, so I decided to write this tutorial instead :)

Requirements:
1. Language packs must deinstall without damage to OOo config files.
2. It should contain at least language files from FreeBSD OpenOffice project.
3. It should check if proper version of OOo is installed.
4. It should contain information about translators, licenses and PBI developer.

Steps:

1. Download OOo langpack from official FreeBSD OOo repositorium. (ftp://ooopackages.good-day.net/pub/OpenOffice.org/FreeBSD/2.0.3/FreeBSD6/)
2. Now you have to find speller+hypernation: Start OpenOffice and select menu: File -> Wizards -> Install new dictionaries.... Click on English and then "Start DicOOo" button. Next -> Retrieve the list.. -> select languages you want dictionaries for. Perform same operations for hypernations in next window. All files are downloaded into ~/.openoffice.org2/usr/workbook directory.
3. Make project directory for your OOo langpack PBI. For example:
mkdir project/et-OpenOffice.org
4. You can extract OOo langpack and copy all dict and hyp. files into OpenOffice.org2.0.3/share/dict/ooo directory and compress this directory again with your favourite archiver.
5. Now we need scripts for PBI Creator:
# Filename: PBI.FirstRun.sh
# Place any custom installation code here.
# This script will be run before your program is extracted into
# /Programs/<ProgNameVer>/
# ${1} is the directory name.
# ${2} is the username of person performing install.
# Return a '2' to halt the PBI installation
# TIP: 'kdialog' should be used for user interaction.
# To interact with the progress dialog echo these flags:
# echo 'TOTALSTEPS: <num>' # Set the total steps of the progress bar
# echo 'SETSTEPS: <num>' # Set the current progress of the progress bar
# echo 'MSG: <text>' # Display this text above progress bar
#########################################
# (c) 19.juuli 2006 Andrei Kolu
#
echo 'TOTALSTEPS: 2'
echo 'SETSTEPS: 1'
echo 'MSG: Searching for OpenOffice 2.0.3...'

sleep 1

if [ -e "/Programs/OpenOffice.org2.0.3" ]
then
else
kdialog --error "OpenOffice.org 2.0.3 is not installed! Please install OpenOffice 2.0.3 PBI and try again."
return 2
fi

echo 'SETSTEPS: 2'
echo 'MSG: Checking previous installation...'

sleep 1

if [ -e "/Programs/et-OpenOffice.org2.0.3" ]
then
kdialog --error "et-OpenOffice.org2.0.3 is already installed! Remove PBI installation and try again."
return 2
fi

Files are self explanatory.

# Filename: PBI.SetupScript.sh
# Place any custom installation code here.
# This script will be run after your program is extracted into
# /Programs/<ProgNameVer>/
# ${1} is the directory name.
# ${2} is the username of person performing install.
# TIP: 'kdialog' should be used for user interaction.
# To interact with the progress dialog echo these flags:
# echo 'TOTALSTEPS: <num>' # Set the total steps of the progress bar
# echo 'SETSTEPS: <num>' # Set the current progress of the progress bar
# echo 'MSG: <text>' # Display this text above progress bar
#########################################
# Eesti keele tugi koos spelleri ja poolitajaga. (c) 19.juuli 2006 Andrei Kolu

echo 'TOALSTEPS: 3'
echo 'SETSTEPS: 1'
echo 'MSG:Back up OOo 2.0.3 config...'

sleep 1
cp /Programs/OpenOffice.org2.0.3/share/dict/ooo/dictionary.lst /Programs/et-OpenOffice.org2.0.3/backup/dictionary.lst.backup
echo "DICT et EE et_EE" >> /Programs/OpenOffice.org2.0.3/share/dict/ooo/dictionary.lst
echo "HYPH et EE hyph_et" >> /Programs/OpenOffice.org2.0.3/share/dict/ooo/dictionary.lst

echo 'SETSTEPS: 2'
echo 'MSG: Installing YOUR_LANGUAGE for OpenOffice 2.0.3...'

cd /Programs/
tar -xvjpf /Programs/et-OpenOffice.org2.0.3/et-OpenOffice.org2.0.3.tar.bz2

echo 'SETSTEPS: 3'
echo 'MSG: Removing temporary installation files...'
sleep 1
rm /Programs/et-OpenOffice.org2.0.3/et-OpenOffice.org2.0.3.tar.bz2

# Filename: PBI.RemoveScript.sh
# Eesti keele toe eemaldamine OpenOffice 2.0.3
# (c) 19.juuli 2006 Andrei Kolu
# Restoring original dictionary.lst file

sed -e '/^DICT et EE et_EE$/d' /Programs/OpenOffice.org2.0.3/share/dict/ooo/dictionary.lst > /Programs/OpenOffice.org2.0.3/share/dict/ooo/dictionary.lst2
sed -e '/^HYPH et EE hyph_et$/d' /Programs/OpenOffice.org2.0.3/share/dict/ooo/dictionary.lst2 > /Programs/OpenOffice.org2.0.3/share/dict/ooo/dictionary.lst

rm /Programs/OpenOffice.org2.0.3/share/dict/ooo/dictionary.lst2

# delete all files
cd /Programs/OpenOffice.org2.0.3/help/et/
rm default.css
rm err.html
rm highcontrast1.css
rm highcontrast2.css
rm highcontrastblack.css
rm highcontrastwhite.css
rm sbasic.cfg
rm sbasic.db
rm sbasic.ht
#rm sbasic.idx
rm sbasic.jar
rm sbasic.key
rm sbasic.tree
rm scalc.cfg
.......
.......
too many lines...removed for readability.

DON'T FORGET TO SET SCRIPTS EXECUTABLE!

I know what files are installed from directory where I unpacked langpack archive file with command:
ls -R OpenOffice.org2.0.3 > deletefiles.txt
Then just added cd command to every directory and rm to every file. Copied all this information over to PBI.RemoveScript.sh.

NOTE: Use appropriate language marks instead of my DICT et EE et_EE and HYPH et EE hyph_et.

6. For application for run in PBI Creator I made simple script that opens konqueror with html information about translators, speller and hypernation authors, license information and PBI creator.

readme.sh:
konqueror /Programs/et-OpenOffice.org2.0.3/readme.html

7. Now you can make PBI with your installed PBI Creator. Remember to set Author to original langpack author who is OpenOffice.org Translation Team, not you and homepage to appropriate translation home page.
8. Test by adding/removing this PBI couple of times and if possible, with different langpacks installed. You can select user interface language from Tools menu -> Options -> Language Settings -> Languages -> User interface
9. Test again.
10. Have fun.

P.S. Strange but PBI Creator is not following symlinks properly, so if your project files is placed in home directory then you have to point to /usr/home/yourname/project/openofficelangpack instead of /home/yourname/project/openofficelanguagepack. This may be bug but maybe not.

TerryP
07-20-2006, 08:19 PM
I'd be happy to make language packs, but I only speak English, Gungaiun, Pokemon, C, some C++, Java, and Perl so I'd have no idea how the finished product looks like.

PS: I think it might be a KDE thing, I remember konqueror got confused and was not showing all my files when looking at /home/${USER} instead of /usr/home/${USER} for some odd reason.

antik
07-25-2006, 01:55 PM
Hi! I post here new scripts for OOo lang pack PBI creation.
Special thanks goes to Charles A. Landemaine for adding more flexibility into scripts.

Requirements:
1. Language packs must deinstall without damage to OOo config files.
2. It should contain at least language files from FreeBSD OpenOffice project.
3. It should check if proper version of OOo is installed.
4. It should contain information about translators, licenses and PBI developer.

Steps:

1. Download OOo langpack from official FreeBSD OOo repositorium. (ftp://ooopackages.good-day.net/pub/OpenOffice.org/FreeBSD/2.0.3/FreeBSD6/)
2. Now you have to find speller+hypernation: Start OpenOffice and select menu: File -> Wizards -> Install new dictionaries.... Click on English and then "Start DicOOo" button. Next -> Retrieve the list.. -> select languages you want dictionaries for. Perform same operations for hypernations in next window. All files are downloaded into ~/.openoffice.org2/usr/workbook directory.
3. Make project directory for your OOo langpack PBI. For example:
mkdir project/et-OpenOffice.org
4. You can extract OOo langpack and copy all dict and hyp. files into OpenOffice.org2.0.3/share/dict/ooo directory and compress this directory again with your favourite archiver.
5. Now we need scripts for PBI Creator:
# Filename: PBI.FirstRun.sh
# Place any custom installation code here.
# This script will be run before your program is extracted into
# /Programs/<ProgNameVer>/
# ${1} is the directory name.
# ${2} is the username of person performing install.
# Return a '2' to halt the PBI installation
# TIP: 'kdialog' should be used for user interaction.
# To interact with the progress dialog echo these flags:
# echo 'TOTALSTEPS: <num>' # Set the total steps of the progress bar
# echo 'SETSTEPS: <num>' # Set the current progress of the progress bar
# echo 'MSG: <text>' # Display this text above progress bar
#########################################
# (c) 23.juuli 2006 Andrei Kolu
# Charles A. Landemaine
#
# set your language and OOo version.
OOOLANGUAGE="et"
OOOVERSION="2.0.3"
OOOCOUNTRY="EE"

echo 'TOTALSTEPS: 2'
echo 'SETSTEPS: 1'
echo "MSG: Detecting OpenOffice.org$OOOVERSION..."

sleep 1

if [ ! -d "/Programs/OpenOffice.org$OOOVERSION" ]
then
kdialog --error "OpenOffice.org $OOOVERSION is not installed! Install OpenOffice.org $OOOVERSION and try again"
return 2
fi

echo 'SETSTEPS: 2'
echo 'MSG: Checking installation...'

sleep 1

if [ -d "/Programs/OpenOffice.org-lang-$OOOLANGUAGE$OOOVERSION" ]
then
kdialog --error "OpenOffice.org $OOOVERSION language pack is already installed."
return 2
fi

Files are self explanatory.

# Filename: PBI.SetupScript.sh
# Place any custom installation code here.
# This script will be run after your program is extracted into
# /Programs/<ProgNameVer>/
# ${1} is the directory name.
# ${2} is the username of person performing install.
# TIP: 'kdialog' should be used for user interaction.
# To interact with the progress dialog echo these flags:
# echo 'TOTALSTEPS: <num>' # Set the total steps of the progress bar
# echo 'SETSTEPS: <num>' # Set the current progress of the progress bar
# echo 'MSG: <text>' # Display this text above progress bar
#########################################
# Eesti keele tugi koos spelleri ja poolitajaga. (c) 23.juuli 2006 Andrei Kolu
# Charles A. Landemaine
#
OOOLANGUAGE="et"
OOOVERSION="2.0.3"
OOOCOUNTRY="EE"

echo 'TOTALSTEPS: 2'
echo 'SETSTEPS: 1'
echo 'MSG: Backing up configuration...'

cp /Programs/OpenOffice.org$OOOVERSION/share/dict/ooo/dictionary.lst /Programs/OpenOffice.org-lang-$OOOLANGUAGE$OOOVER
SION/backup/dictionary.lst
echo "DICT et EE et_EE" >> /Programs/OpenOffice.org$OOOVERSION/share/dict/ooo/dictionary.lst
echo "HYPH et EE hyph_et" >> /Programs/OpenOffice.org$OOOVERSION/share/dict/ooo/dictionary.lst

echo 'SETSTEPS: 2'
echo 'MSG: Extracting files...'

cd /Programs/
tar -xvjpf /Programs/OpenOffice.org-lang-$OOOLANGUAGE$OOOVERSION/langfiles.tbz -C /Programs/OpenOffice.org$OOOVERSION/

echo 'SETSTEPS: 3'
echo 'MSG: Cleaning up temporary files...'
sleep 1
rm /Programs/OpenOffice.org-lang-$OOOLANGUAGE$OOOVERSION/langfiles.tbz


# Removing OpenOffice 2.0.3 langpack
# (c) 23.juuli 2006 Andrei Kolu
# Charles A. Landemaine
#
OOOLANGUAGE="et"
OOOVERSION="2.0.3"
OOOCOUNTRY="EE"

# Restoring original configuration
sed -e '/^DICT et EE et_EE$/d' /Programs/OpenOffice.org2.0.3/share/dict/ooo/dictionary.lst > /Programs/OpenOffice.org2.
0.3/share/dict/ooo/dictionary.lst2
sed -e '/^HYPH et EE hyph_et$/d' /Programs/OpenOffice.org2.0.3/share/dict/ooo/dictionary.lst2 > /Programs/OpenOffice.or
g2.0.3/share/dict/ooo/dictionary.lst

rm /Programs/OpenOffice.org2.0.3/share/dict/ooo/dictionary.lst2

# Delete all installed files
cd /Programs/OpenOffice.org2.0.3/help/et/
rm default.css
rm err.html
rm highcontrast1.css
rm highcontrast2.css
rm highcontrastblack.css
rm highcontrastwhite.css
rm sbasic.cfg
rm sbasic.db
rm sbasic.ht
#rm sbasic.idx
rm sbasic.jar
rm sbasic.key

.......
.......
too many lines...removed for readability.

DON'T FORGET TO SET SCRIPTS EXECUTABLE!

I know what files are installed from directory where I unpacked langpack archive file with command:
ls -R OpenOffice.org2.0.3 > deletefiles.txt
Then just added cd command to every directory and rm to every file. Copied all this information over to PBI.RemoveScript.sh.

NOTE: Use appropriate language marks instead of my DICT et EE et_EE and HYPH et EE hyph_et.

6. For application for run in PBI Creator I made simple script that opens konqueror with html information about translators, speller and hypernation authors, license information and PBI creator.

readme.sh:
konqueror /Programs/et-OpenOffice.org2.0.3/readme.html

7. Now you can make PBI with your installed PBI Creator. Remember to set Author to original langpack author who is OpenOffice.org Translation Team, not you and homepage to appropriate translation home page.
8. Test by adding/removing this PBI couple of times and if possible, with different langpacks installed. You can select user interface language from Tools menu -> Options -> Language Settings -> Languages -> User interface
9. Test again.
10. Have fun.