Help:Howto/How to translate langpacks

From Miranda NG
Jump to: navigation, search

How to translate

Tip
You are expected to have the whole Miranda NG Git checked out: https://github.com/miranda-ng/miranda-ng. If you don't want the whole repository, you need at least both langpacks and tools folders in the same folder on your disk.
You should make your own fork of that repository.

Notes:

  • All files of your langpack must be saved in UTF-8 codepage (without BOM) with Windows-style line breaks (CR LF)
  • Refresh.bat must be started from /langpacks/<language>/ folder
  • Final langpack_<language>.txt is automatically created after running Refresh.bat

Creating a new langpack

  1. Create new folder for langpack in /langpacks/ folder
  2. Create subfolders there: Plugins, Untranslated and file =HEAD=.txt (see the existing langpacks to know what should be in this file)
  3. (optional) Take an old langpack file (e. g. from Miranda IM; it must be previously converted to UTF-8) and put it somewhere (e. g. into new subfolder Deprecated)
  4. Copy Refresh.bat from /langpacks/czech/ and edit it – change "czech" to name of your langpack folder and change path to the old langpack (if exists; leave empty otherwise)
  5. Run Refresh.bat – it will create all files which will now contain translation from your old langpack (or empty translations if you have no old langpack)

Translating

  • Remember to make backups before running Refresh.bat, as it overwrites all your files.
  • Each plugin has its translation in a separate file Plugins/<PluginName>.txt. Note that the same English word can have multiple meanings, translate them in the context.
  • All files are like this. First string is the English line, your translation is below:
[Decide &later]
&Später entscheiden
  • Be aware that the space for the resources won't be dynamically resized, please test if translated strings fit the dialog. If not, cut them or ask in the forum for a possible relayout.
  • Some strings contain the %X variables, it is important to keep those variables in exactly the same order in your translation (See here for details):
[%s added you to the contact list\n%u (%s) on %s]
%s hat Sie zu Ihrer Kontaktliste hinzugefügt\n%u (%s) in %s
  • Some strings contain & symbol which means a keyboard shortcut. Try to use the same in your translation to keep it consistent, or use something typical to your language.
[Re&ad status message]
St&atusnachricht lesen

Updating langpack

  1. Write your translations into =CORE=.txt file and files inside Plugins folder (don't touch Untranslated folder, those files have only informative character of what translations are missing)
  2. Run Refresh.bat which will redistribute your changes to other files

After English langpack update

  1. Run Refresh.bat which will apply changes to your files
  2. Check changed files, correct typos or made translation changes
  3. Run Refresh.bat which will redistribute your changes to other files

Submitting your work

  1. Push your changes in your own fork of miranda-ng.
  2. Make a pull request to miranda-ng main repository once you feel your work is done.

Langpack structure

You can find actual langpacks versions here.

The english folder contains a translation template. It is updated regularly, and contains strings that need to be translated. You shouldn't edit it manually.

Important
The exception is the plugins written in Pascal (Actman, HistoryPP, mRadio, QuickSearch, Watrack). Their templates are not generated automatically.

Sometimes for different reasons some strings do not get into the English template (for example, the names of sections and subsections of icons setting).These strings are also the names of database sections or settings, so they can not be marked as "translatable" in sources (otherwise the database settings will be reset when the language is changed). However, these lines still need to be translated, so their translation is done in a separate file.

=HEAD=.txt

Header. Contains information about language and authors.

Miranda Language Pack Version 1
Language:
Locale:
Authors:
Author-email:
Last-Modified-Using:

All lines, except the first two, are optional. "Language" value will be displayed in the language selection menu.

=CORE=.txt

Strings from core and Std-plugins. Сomments must begin with a ;.

Plugins\

The Plugins folder contains plugin translations.

The search algorithm for the translated strings: the translation of each plugin starts with its ID (#muuid {...}). If a string is not found in the plugin section, then its search will be performed in whole translation file, from the beginning. #muuid {...} allows to translate identical English strings in different manner, for example:

[Clear]
Ясно

for Weather

[Clear]
Очистить

for all other plugins.

Note
Duplicate the same lines within the translation of same plugin does not make sense, since Miranda will only use the first option found.

All strings are case sensitive. This means the difference between [Abc] and [abc].

The space at the end of the line (if it exists in the English template) should be replaced with \s in the translated string (see commit 5674). The left space remains untouched:

[ Actions ]
 Действия\s

If the original string starts with the [ or #, it should be escaped with a slash in the translated string:

[[Me]]
\[Я]

[# Solid color fill]
\# Заливка цветом

Every translation file ends with an empty string.

Utilities

lpgen.js

Generates English template from source code.

LangpackSuite.exe

Combines =HEAD=.txt, =CORE=.txt and Plugins\ content into single file. Also can create a translation based on Version information.

Langpackmgr.exe

Editor. The utility compares the translated file with the template and displays the missing strings. Here you can edit and save the edited file. Creates missing files, reports the status of the translation of each file and the whole translation.

If you want to keep untranslated string

[some untranslated string]
<пустая строка для перевода>

you should create empty clearstring.ini file beside LangPackMgr.exe. More info about this tool on our forum.

Refresh.bat

Updates the translation files according to the English template. Untranslated strings will be placed in /langpacks/<language>/Untranslated/ folder.