Help:Howto/How to translate langpacks: Difference between revisions

From Miranda NG
Jump to navigation Jump to search
No edit summary
 
(28 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Todo|lang=en|Needs revision.}}
== How to translate ==
== How to translate ==
<div style="overflow:auto; height:auto;">
{{TNT|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 <tt>langpacks</tt> and <tt>tools</tt> folders in the same folder on your disk.<br />You should make your own fork of that repository.'''}}
{{Message|message=You are expected to have the whole Miranda NG SVN checked out http://svn.miranda-ng.org/main/trunk If you don't want the whole repository, you need at least both '''langpacks''' and '''tools''' folders in the same folder on your disk.'''}}
</div>


'''Notes:'''
'''Notes:'''
* All files of your langpack must be saved in UTF-8 codepage
* All files of your langpack must be saved in UTF-8 codepage (without BOM) with Windows-style line breaks (CR LF)
* <tt>Refresh.bat</tt> must be started from <tt>/langpacks/<language>/</tt> folder
* <tt>Refresh.bat</tt> must be started from <tt>/langpacks/<language>/</tt> folder
* Final <tt>langpack_<language>.txt</tt> is automatically created after running <tt>Refresh.bat</tt>
* Final <tt>langpack_<language>.txt</tt> is automatically created after running <tt>Refresh.bat</tt>
Line 13: Line 10:
# Create new folder for langpack in <tt>/langpacks/</tt> folder
# Create new folder for langpack in <tt>/langpacks/</tt> folder
# Create subfolders there: <tt>Plugins</tt>, <tt>Untranslated</tt> and file <tt>=HEAD=.txt</tt> (see the existing langpacks to know what should be in this file)
# Create subfolders there: <tt>Plugins</tt>, <tt>Untranslated</tt> and file <tt>=HEAD=.txt</tt> (see the existing langpacks to know what should be in this file)
# 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 <tt>Deprecated</tt>) (optional)
# (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 <tt>Deprecated</tt>)
# Copy <tt>Refresh.bat</tt> from <tt>/langpacks/czech/</tt> and edit it – change "czech" to name of your langpack folder and change path to the old langpack (if exists, leave empty otherwise)
# Copy <tt>Refresh.bat</tt> from <tt>/langpacks/czech/</tt> and edit it – change "czech" to name of your langpack folder and change path to the old langpack (if exists; leave empty otherwise)
# Run <tt>Refresh.bat</tt> – it will create all files which will now contain translation from your old langpack (or empty translations when you have no old langpack)
# Run <tt>Refresh.bat</tt> – 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 <tt>Refresh.bat</tt>, as it overwrites all your files.
* Each plugin has its translation in a separate file <tt>Plugins/<PluginName>.txt</tt>. 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:
<pre>
[Decide &later]
&Später entscheiden</pre>
* 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 [http://www.cplusplus.com/reference/cstdio/printf/ here] for details):
<pre>
[%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
</pre>
* 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.
<pre>[Re&ad status message]
St&atusnachricht lesen</pre>


=== Updating langpack ===
=== Updating langpack ===
# Write your translations into <tt>=CORE=.txt</tt> file and files inside <tt>Plugins</tt> folder (don't touch <tt>Untranslated</tt> folder, those files have only informative character of what translations are missing)
# Write your translations into <tt>=CORE=.txt</tt> file and files inside <tt>Plugins</tt> folder (don't touch <tt>Untranslated</tt> folder, those files have only informative character of what translations are missing)
# Run <tt>Refresh.bat</tt> which will redistribute your changes to other files
# Run <tt>Refresh.bat</tt> which will redistribute your changes to other files
 
=== After English langpack update ===
=== After english langpack update ===
# Run <tt>Refresh.bat</tt> which will apply changes to your files
# Run <tt>Refresh.bat</tt> which will apply changes to your files
# Use TortoiseSVN / ''Check for modifications'' context menu item and check changed files there to easily correct typos or translation changes
# Check changed files, correct typos or made translation changes
# Run <tt>Refresh.bat</tt> which will redistribute your changes to other files
# Run <tt>Refresh.bat</tt> which will redistribute your changes to other files


== External links ==
== Submitting your work ==
* [http://tortoisesvn.net TortoiseSVN] a free Subversion client
# Push your changes in your own fork of miranda-ng.
# Make a pull request to miranda-ng main repository once you feel your work is done.
 
== Langpack structure ==
You can find actual langpacks versions [https://github.com/miranda-ng/miranda-ng/tree/master/langpacks here].
 
The <tt>english</tt> folder contains a translation template. It is updated regularly, and contains strings that need to be translated. You shouldn't edit it manually.
{{TNT|Important|The exception is the plugins written in Pascal ({{Plugin|Actman}}, {{Plugin|HistoryPP}}, {{Plugin|mRadio}}, {{Plugin|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 [https://github.com/miranda-ng/miranda-ng/blob/master/langpacks/russian/Plugins/_Various.txt a separate file].
 
=== =HEAD=.txt ===
Header. Contains information about language and authors.
<pre style="overflow:auto;">
Miranda Language Pack Version 1
Language:
Locale:
Authors:
Author-email:
Last-Modified-Using:
</pre>
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 <tt>;</tt>.
 
=== Plugins\ ===
The <tt>Plugins</tt> folder contains plugin translations.
 
The search algorithm for the translated strings: the translation of each plugin starts with its ID (<tt>#muuid {...}</tt>). If a string is not found in the plugin section, then its search will be performed in whole translation file, from the beginning. <tt>#muuid {...}</tt> allows to translate identical English strings in different manner, for example:
<pre style="overflow:auto;">
[Clear]
Ясно
</pre>
for {{Plugin|Weather}}
<pre style="overflow:auto;">
[Clear]
Очистить
</pre>
for all other plugins.
 
{{TNT|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 <tt>\s</tt> in the translated string (see {{Rev|ce7a393172adf13ad1e990e970c1acac896dea7f|commit ce7a393172}}). The left space remains untouched:
<pre style="overflow:auto;">
[ Actions ]
Действия\s
</pre>
 
If the original string starts with the <tt>[</tt> or <tt>#</tt>, it should be escaped with a slash in the translated string:
<pre style="overflow:auto;">
[[Me]]
\[Я]
 
[# Solid color fill]
\# Заливка цветом
</pre>
 
Every translation file ends with an empty string.
 
== Utilities ==
=== lpgen.js ===
Generates English template from source code.
 
=== LangpackSuite.exe ===
Combines <tt>=HEAD=.txt</tt>, <tt>=CORE=.txt</tt> 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
<pre style="overflow:auto;">
[some untranslated string]
<пустая строка для перевода>
</pre>
you should create empty <tt>clearstring.ini</tt> file beside <tt>LangPackMgr.exe</tt>. More info about this tool [https://forum.miranda-ng.org/index.php?topic=112.0 on our forum].
 
=== Refresh.bat ===
Updates the translation files according to the English template. Untranslated strings will be placed in <tt>/langpacks/<language>/Untranslated/</tt> folder.
 
[[Category: Howto]]

Latest revision as of 12:20, 13 May 2021

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, 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 ce7a393172). 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.