Translation

YourOtherMind uses GNU.Gettext in code to handle translation of the main application. This page describes how to generate the files needed to faciliate translation.

If you just want to translate the YourOtherMind Writing Environment to another language contact me. This page is more for programmers wishing to expand/work with the translation system.

Note: The gettext call is wrapped into CoreUtilities2013 (the loc.cs file).

Anyways, to build the required translation files, I created two batch files to help. The first generates a file that can be be edited by POEDIT

Batch #1: Generate .pot file.

REM This creates a POS file that can be turned through POEDIT into a PO file that can be translated
C:\Users\Public\Documents\Projects\librariesused\GettextNet\Bin\Release\GNU.gettext.xgettext.exe -D "C:\Users\Public\Documents\Projects\Utilities\yom2013B" --recursive -o "C:\Users\Public\Documents\Projects\Utilities\yom2013B\output\strings\messages.pot"

REM Afterwards http://sourceforge.net/p/gettextnet/wiki/Home/ you must build resource assemblies using YOM_Translate_Step_2
pause

When this batch file command is ran the template file should be created. It works by processing every code file in the directory “yom2013B”, including subdirectories.

Now with a .pot file we can run POEDIT. This is an open source editor that allows us to write translation strings.

1. Choose “New Catalog From POT FILE”. And then import the .pot file we previously generated.
2. You will be asked to save as a .po file. This will be the file for a particular language.
3. Once saved, you translate the strings.
4. When finished we need to convert the .po file into a language resource to be included with the game.

(NOTE: Everything beyond this point needs more verification, as I have not tested it in a while).

Here’s the batch file that converts a .po resource (it shows two examples, french and german).
NOTE: You need to include a valid Project Name (i.e., can’t leave it as a default in poedit).

With this batch file you see that you define the “language” that the specified file will represent.

rem french
C:\Users\BrentK\Documents\Projects\librariesused\GettextNet\Bin\Release\GNU.Gettext.Msgfmt.exe -v -l fr-FR -d C:\Users\BrentK\Documents\Projects\Utilities\yom2013B\output -r coreutilities2013 -L C:\Users\BrentK\Documents\Projects\Utilities\yom2013B\output C:\Users\BrentK\Documents\Projects\Utilities\yom2013B\output\strings\default.po
rem german
C:\Users\BrentK\Documents\Projects\librariesused\GettextNet\Bin\Release\GNU.Gettext.Msgfmt.exe -v -l de-DE -d C:\Users\BrentK\Documents\Projects\Utilities\yom2013B\output -r coreutilities2013 -L C:\Users\BrentK\Documents\Projects\Utilities\yom2013B\output C:\Users\BrentK\Documents\Projects\Utilities\yom2013B\output\strings\german.po

Note: In this case the call to GetTextResourceManager takes place in coreutilities2013 and hence that’s why it is indicated here.

The output, in the appropriate language subfolder, will a dll file.

** Still needs documentation: Where exactly to put the compiled resource.

NOTE:
For the second batch (the compiling step) to work, you need to setup your path variable to the compiler.

From: http://msdn.microsoft.com/en-us/library/ms379563(v=vs.80).aspx

If you wish to use .NET command line tools from any Command prompt, you will need to manually update your machine's Path variable. To do so, right-click on the My Computer icon on your desktop and select the Properties menu option. From the resulting dialog box, click the Environment Variables button located under the Advanced tab. From that resulting dialog box, add the following directory listings at the end of the current Path variable found in the System variables list box (be aware that each entry must be separated by a semicolon):
C:\Windows\Microsoft.NET\Framework\v2.0.40607
C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin

One Response

  1. Translation
    at ·

    […] (somewhat rough) page has been added describing, for programmers, how to work with the translation system in the YourOtherMind writing environment. Probably not overly exciting for […]

Leave a Reply