Sitemap

Lgi now supports cross-platform multi-language
for all applications
that choose to use it, however at this time
Scribe and i.Ftp are the
main applications taking advantage of the translation capabilities of
Lgi.

Nitty-gritty

Well, how do you actually create new translations?

To start with you will need to download the latest
version of the application (whatever that is) so that you have
an up to date resource file. You should also download a
copy of LgiRes, the editor for the resource file.

The language data is stored in the .lr8 file that came with the application.
You can open this up in a text editor or LgiRes and have a
browse through
the raw UI information. Worst comes to worst you
can edit this directly to add a language but it's
probably going to be easier to use LgiRes, the
custom application for editing .lr8 files.
I'm telling you this so that you to be aware
of the second option if you have trouble with
LgiRes.

After adding the translation to the .lr8 file you
can start the application to see your changes. If
your computers language is set to whatever language you
are adding you should see the new text in the dialogs
etc. But if your settings are just english that
you can change the language inside the program.

For Scribe use Options -> Appearence
and then restart the application. For i.Ftp use the
Language menu.

Editing the lr8 file using LgiRes

Start LgiRes. Open the lr8 file and wait for it to load.

You can hide and show the various languages inside the lr8 file
using View -> Show Languages menu. Also the View menu can change
the languages shown in lists and dialogs:

(click to enlarge)

Scroll down to the string groups in the tree of resources:

Click on each string group, and then click the yellow bordered 'L'
to add a language to the group, select the language you are
going to translate to and click Ok.

Now you have an extra column labelled with the language you
just added. You can now select each string in the list and add
the translation of the text in the edit boxes in the lower left
part of the window.

As you go save the file to app2.lr8, app3.lr8 every 15 minutes
or so. That you have a history of backups that you can revert to.

If a string doesn't have a direct translation, ie the "..."
strings, just leave it. The program will default back to english
where there is no translated string. If your translation is the
same as the english then LgiRes will discard it when it saves the
file, this is just to save space.

After all the strings are translated, go down the the menu
"ID_MENU".

Add your language to the menu by clicking the
yellow bordered "L":

This way you can add
a new language. Then go through each item in the tree
and fill out the translations of the menu items.

When the translation is finished, you can test your work by starting
the application with the command line shown above and your lang code to see
the new translation in action. Mind you you'll have to back up the original
lr8 file and copy in your edited version for this to work.

When your happy with the translation, send the lr8 file to me
so that I can include it in the next version of the application. That way
everyone benifits from your work.

When new versions of the software are released there are often new
bits of user interface and strings, which need translating too. The
best way to find untranslated strings is to use Edit -> Find and
select the "Find missing translation in this language" option with
your translation's language selected.

Editing the lr8 file directly

Firstly you must use a text editor that can handle utf-8 to edit
the lr8 file.

It's not as hard as it sounds. Really! Basically
at the top of the file theres lots of string
definitions which associate a numerical value
with one or more strings in different languages.
This allows the one user interface element to have
different text without being defined twice.
Unlike in WIN32 resource scripts where each dialog
is defined differently for different languages
and updating the user interface means opening every
version of the dialog and making your change.

Anyway back to the task of adding a translation. The
initial strings look something like this:

This is standard XML markup, so all the XML formatting rules
apply. The line breaks and attributes are not sensitive
to whitespace. However you can put a new line character
in a string using '\n'. You'll see that some strings have
'\n' in them, and you should try and include those in your
translation.

Ok the initial "String" says that
this tag is a string, and the "Ref" is a globally
unique value to link this string with an element
in the user interface, defined later in the file.
The "Define" the value is use in my C++ code to
reference the string or user interface element. So
changing that won't effect anything. The interesting
part is the language attributes. These define
the text for different languages, in this example "en"
is the code for english and "fr" is the code for
french. So this element has 4 languages. To add a
translation to spanish for instance you would add
an attribute like this: