Translate

There are several “po” files for various languages to make Cinelerra-GG more usable for non-english countries, with varying levels of completeness or correctness.  With ongoing development, new phrases are added and need to be translated. The information below is provided to make the job of providing language translations as easy as possible for Cinelerra-GG. However, there are several steps involved and the task is somewhat difficult. Because this help is much appreciated by multiple users, if you send an email to cin[@]lists.cinelerra-gg[dot]org, a new updated cin.po with your current language translations already in can be generated for you.  Then all you would need to do is run poedit on it to complete any missing translations and notify the mailing list of completion and location of the new file.

For a more difficult route, but still manageable, here is a complete list of instructions to create your language translations. A program, xlat.C, assists in providing several variations of text files that can be used in order to allow anyone to help make meaningful translations. To build a new cin.po file, do the following after moving to cinelerra’s directory:

./po/xlat.sh > /tmp/cin.po

This file will have only english words/phrases in it.  Next, to use the xlat.C program, first compile it with “c++ xlat.C”. You can see the usage help here:

# ./a.out
  list csv ./a.out csv < data.csv > data.po
  list po ./a.out po < data.po > data.csv
  list po ./a.out dups < data.po
  list po ./a.out nodups < data.po
  get strings ./a.out key < xgettext.po
  gen xlation ./a.out xlat xgettext.po xlat.csv
  gen xlation ./a.out xlat – text,xlat … < xgettext.po

This program has 6 commands where the desired command is the first parameter to a.out.:

1) “csv” = comma separated value file; to recreate a po from a csv file.
2) “po” = convert po to csv data; for example, what you need to convert ru.po to ru.csv.

     You can even open the resulting *.csv in ooffice and update the key->value replacements
     (fields separated by “,” only and check quoted fields as text during import). These results can
     be “Saved As” a csv file, and then used by xlat.C to reformulate a “po”.

3) “dups” = list only key/value items where either the key=value or value=””.
4) “nodups” = list only key/value items where key!=value and value!=””.
5) “key” = list cin.po key set.
6) “xlat” = overlay translation. This is the most important use and is described next.

The xlat command line parameters specify a new cin.po template, usually created with xlat.sh, and a list of key/value files which are used to build a mapping for the desired translation. The mapping files are added to the mapping in the order they appear on the command line, and any existing key is replaced with the newest definition; so typically the newest key/value data is last in the command parameters. Once the mapping is built, the first parameter, the new po template, is scanned and the keys it contains are used to find the latest mapping in the key/value files. The new value replaces the existing value in the template. For example, to overlay a new map onto an existing po:

c++ xlat.C
./a.out po < xx.po > /tmp/xx.csv
./a.out po < new.po > /tnp/new.csv
./a.out xlat xx.po /tmp/xx.csv /tmp/new.csv > /tmp/new.po

The first run preserves the existing mapping of xx.po, the second creates new mappings from new.po, and the third merges the original and new mappings to create a po with new included/overriding xx.po.  This new.po file can now be edited to include the translations with your favorite editor or poedit.

Because some words and abbreviations can lead to ambiguous language translations, the usage of C_ and D_ in the program code to represent Contextual and Definitional exceptions to the usual _ and N_ may be necessary. You will see the following:

C_(“msgstr”) is translated to D_(“qual#msgstr”) by xlat.sh,
and invokes gettext with msgid = “qual#msgstr”.

When no ‘po’ translation is supplied, the qual# is removed, and only the default ‘msgstr’ text is displayed. If a ‘po’ translation is defined for the current locale, then the translated msgid = ‘qual#msgstr’ is used to access the translated msgstr.

The default MSGQUAL is the basename of the C source file. For the file src_file.C, the default MSGQUAL is:

#define MSGQUAL “src_file”

It is used to define the qualifier needed to transform:

C_(“str”) to D_(“src_file#str”)

The resulting xlat.sh’d source is scanned by xgettext to create the initial cin.po. In other words:
_(s) does normal international text translation as always –
The msgid line is: msgid “s”

C_(s) makes it appear as if you used D_(“src_file#” s) –
The msgid line is: msgid “src_file#s”
If it does not translate, the default msgtext is “s”, not “src_file#s”

D_(qual#s) trys to look up _(qual#s) –
This msgid line is: msgid “qual#s”,
If it does not translate, the default msgtext is “s”, not “qual#s”

Summary:
use _(s) as usual in almost all cases
use C_(s) if this source file has specialized meaning for s
use D_(qual#s) if this source file has several meanings for s