Re: open translations database
- From: Karl Eichwalder <keichwa gmx net>
- To: gnome-i18n gnome org
- Subject: Re: open translations database
- Date: Mon, 6 Nov 2000 23:52:31 +0100 (CET)
Alexandre Hautequest <hquest@fesppr.br> writes:
> I think we can reduce a huge amount of translatable messages if we got
> some "default" messages, and just use them instead of translate again
> in a new potfile.
Just create a Translation Memory using my recently announced po-toys
package: http://www.suse.de/~ke/po-toys/ ;)
Here is a somehow lengthy explanation I forgot to add to the release:
PO File Management
Karl Eichwalder
_________________________________________________________________
Table of Contents
Creating a PO File Translation Memory
Using a PO File Translation Memory
_________________________________________________________________
Creating a PO File Translation Memory
A Translation Memory is a library of translations (messages, phrases,
nouns) which could be used to initialize or normalize a translation
project. You can use PO files to create such a Translation Memory.
Since command line tools coming with the gettext package are able to
merge and update PO files no special programs are needed.
To merge two or more PO files use msgcomm; to merge the following
three PO files with German translations issue the following command:
msgcomm --more-than=0 --output=memory.de.po \
gnome-libs/po/de.po \
gnome-core/po/de.po \
gnome-applets/po/de.po
This command will collect all messages from all files and write them
to the file memory.de.po. The first encountered message will win. The
means the PO file with the best translations should come first. Use
this technique with care. This command will happily collapse messages
with the same msgids; sometimes the target language has to translate
the same words differently!
For convenience you can use the wrapper script po-make-memory.sh to
write the file memory.LL.po:
po-make-memory.sh -l LL FILE1.LL.po FILE2.LL.po
_________________________________________________________________
Using a PO File Translation Memory
You can use a PO file Translation Memory (cf. the section called
Creating a PO File Translation Memory how to create a Translation
Memory) to start a new project or to update and normalize existing PO
files.
_________________________________________________________________
Starting a New Project File
First you will create a so called POT file containing all strings to
translate. xgettext will extract the strings form the program source
file and write the POT file. Normaly the package will have a Makefile
target $(package).pot which you can call in the po subdirectory:
cd po
make project.pot
Then use msgmerge to extract translations from the memory file and
merge them with the POT file:
msgmerge --output-file=project.de.po memory.de.po project.pot
Problem: This msgmerge command will also append not needed
translations from the memory file to the file project.de.po and flag
them as obsolete:
#~ msgid "Run Program"
#~ msgstr "Programm ausführen"
#~ msgid "Run"
#~ msgstr "Ausführen"
#~ msgid "Cancel"
#~ msgstr "Abbrechen"
#~ msgid "Select a program to run"
#~ msgstr "Ein Programm zum Ausführen auswählen"
Remove the obsolete entries with a simple awk script:
awk '{if (/^#~/) exit; else print}' project.de.po > de.po
Or sed (how to suppres the output of the current pattern space?):
sed '/^#~/q' project.de.po | sed '/^#~.*/d' > de.po
For convenience you can use the wrapper script po-initialize.sh to
write the file LL.po:
po-initialize.sh memory.LL.po FILE.pot LL.po
_________________________________________________________________
Updating or Normalizing a Project File
Sometime it's needed to normalize or update a PO file using a
Translation Memory file. The following command will do this job:
cp de.po old-de.po
msgcomm --more-than=1 --output=common.de.po memory.de.po old-de.po
msgcomm --more-than=0 --output=de.po common.de.po old-de.po
# rm -f common.de.po old-de.po
For convenience you can use the wrapper script po-normalize.sh to
write the file LL.po; the command:
po-normalize.sh memory.de.po de.po
will create new-de.po. Use the switch -o to override the input file
de.po:
po-normalize.sh -o memory.de.po de.po
--
work : ke@suse.de | ,__o
: http://www.suse.de/~ke/ | _-\_<,
home : keichwa@gmx.net | (*)/'(*)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]