Difference between revisions of "Interface translation"

From Inkscape Wiki
Jump to navigation Jump to search
m (→‎Get the PO file for your language: replace dead link with a new one)
 
(29 intermediate revisions by 4 users not shown)
Line 1: Line 1:
Go Back to the main [http://wiki.inkscape.org/wiki/index.php/Translation_information Translation information] page.
Go back to the main [[Translation information]] page.


== Introduction to PO file format ==
== Main translation files ==


If you've never translated a PO file before, you will find its syntax very simple. The PO format is a really simple format, which probably at least partly explains its success and widespread use. The format is basically a hash list consisting of msgid and msgstr pairs, with the msgid being the original English string and key, and the msgstr being the translated value of it. Below is an example of a message.
=== 1. Coordinate ===


  #: gedit/dialogs/gedit-plugin-program-location-dialog.c:78
As there may be other persons also currently working on the translation to your language, as a first step, please let your colleagues on the translators mailing list know that you'd like to start working on your language's translation, and coordinate your efforts (e.g. divide the work, set up a review system, … ). You can also check the mailing list archives to see whether there may be others who have started working on it recently. You can also ask for help finding previous translators for your language in the chat, to join their team.
  #: gedit/dialogs/program-location-dialog.glade2.h:2
  msgid "Set program location..."
  msgstr "Ställ in programplats..."


In addition to the msgid and msgstr parts, a message usually also has lines starting with #: that tells what source files and what lines the string used as msgid was extracted from. These lines have no syntactic value. They are only there as a help for translators and developers to know where a message came from.
=== 2. Get the file ===
Get the most up-to-date translation files from GitLab's automatic builds:


A message in a PO file can be in one of essentially three different states. The message can be translated, fuzzy, or untranslated. A message counts as translated as soon as the msgstr part of it is non-empty. In a similar manner, an untranslated message is one where the msgstr is empty. The fuzzy state is special and essentially means that there is a translation in the msgstr part, but that this translation is most likely not entirely correct, and that it thus needs manual attention by a translator. A message can become fuzzy in one of two ways:
For the main development branch:
https://gitlab.com/inkscape/inkscape/-/jobs/artifacts/master/download?job=translations


* The original string that the msgid represents was changed in the source code.  A typo in the string may have been fixed or the string altered in some other way. The translator needs to check that the msgstr is still valid and make changes if necessary.
For release branches:
* A new string has been added to the source, and the string is very similar, but not identical, to the msgid of an already existing, translated message. Then the msgstr of that message will be automatically reused for the new message, but the new message will also at the same time be marked fuzzy so that the translator knows there is some difference that he or she needs to adapt the translation to match.
https://gitlab.com/inkscape/inkscape/-/jobs/artifacts/<branch name>/download?job=translations


There is always one special message in each valid PO file: the PO file header. It is encoded with the msgid for the empty string ("") as the key, and the actual header values are in the msgstr part. This unfortunately means that if you mark an empty string for translation, you will get the entire PO file header back as the "translation". In almost all cases this is probably not what you want. Hence, do not mark empty strings for translation.
The name of the release branch is usually something like '1.0.x' or '1.1.x'. You can ask on the mailing list or in the chat which branch is the current translation target.


== Get the PO file for your language ==
In some cases, this will give a 'Page not found' error. In that case, visit the [https://gitlab.com/inkscape/inkscape/ main Inkscape repository page on GitLab], select the correct branch at the top, then on the right side, click on the download icon and select to download the 'translations' artifact.


Download the .po file for your language from here:
Unzip the downloaded file and select the po file for your language from it.


    http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/files/head:/po/
=== 3. Translate ===


If a .po file for your language does not yet exist, then you will have to get an empty template file to start a new translation.
Translate the file for your language from the archive above with your [https://wiki.inkscape.org/wiki/index.php/Translation_information#Tools_for_translators favorite translation software].
You may also need to use the updated template file (mentioned blow) to bring the .po file up to date with new strings introduced in the UI.


The most straightforward way to obtain the inkscape.pot template is to download it from here:
Tip: if you encounter a case where, in the English text, the order of formatting arguments (numbers or text snippets that will be inserted into the string when the program runs) is different from the order in your language, and the arguments are not numbered in the original string, [https://gitlab.com/inkscape/inbox/-/issues/6544#note_996695887 you can try this].


    http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/annotate/head:/po/inkscape.pot
=== 4. Test ===


Alternatively, you can checkout the full BZR project repository and generate the project template. Information on how to get the source tree can be found [http://inkscape.org/bzr.php?lang=en here]. Then, you have to follow some steps in order to generate the template:
# Make sure you have the release of Inkscape you are translating installed. If you're translating the coming release, pick a pre-release and compile it.
# Compile your PO file to .mo. Some translation tools (e.g. Poedit) have an option for that.
# Find and replace your language's .mo file. It is a file named ‘locale/your_language/LC_MESSAGES/inkscape.mo’, in the directory listed under '''Edit > Preferences > System > Inkscape Data''' in Inkscape. <br>''Note: This will not work with the snap, .dmg, AppImage or flatpak version of Inkscape, but only with a version that has been properly installed on your system and with extracted binary archives (zip files for Windows) or self-compiled versions. In some cases, you may need administrator privileges to edit files in said directory.''
# Rename the original inkscape.mo file to inkscape.mo.bak and save your compiled .mo file into its place as inkscape.mo instead
# Then start Inkscape and you'll see your strings!


1. "./autogen.sh"
=== 5. Get a GitLab account ===
2. "./configure"
3. enter the "po" directory: "cd po"
4. generate the current PO template: "intltool-update --pot"


To make an absolutely up-to-date translation (in case the PO file in BZR is not up-to-date enough),
If you don't have an account yet, now is the time to [https://gitlab.com/users/sign_up create one]


1. update your local copy of Inkscape in the usual way: "bzr pull"
=== 6. Exchange the file on GitLab ===
2. merge your existing translations into the new POT file (inkscape.pot):


    "msgmerge your_latest_PO_file inkscape.pot > new_PO_file"
For Inkscape 1.3.x, visit
<code><nowiki>https://gitlab.com/inkscape/inkscape/-/blob/1.3.x/po/<your_locale>.po</nowiki></code>


If you want to update ALL .po files in po/, cd there and run:
For the main development branch, go to  
<code><nowiki>https://gitlab.com/inkscape/inkscape/-/blob/master/po/<your_locale>.po</nowiki></code>


make update-po
Click on the "Replace" button and upload your translated file.


Now that you have an empty PO template, you can start translating the messages.
Enter your commit message below (something like "Update <your_locale>"). Choose a name for your branch. Do not use the same name as the target branch, but something like 'es_translations_for_1.3'.


You can track progress of all Inkscape translations here :
=== 7. Make a merge request ===
    https://inkscape.org/en/doc/devel/translations-statistics-trunk.html


== Tools for translators ==
Click on the "Create merge request" button.


You can edit PO files from any plain text editor, since they are simple text files. However, many useful tools have been developed to provide a simple experience translating PO files.
In the form, check 'Allow commits from members who can merge to the target branch' and also 'squash commits'.


* emacs' po-mode (contained in the gettext distribution; the version in po-utils is old)
Submit the merge request.
* kbabel (http://i18n.kde.org/tools/kbabel/)
* gtranslator (http://gtranslator.sourceforge.net/)
* poEdit (http://www.poedit.net/)
* GEdit (installed on GNOME desktops) has a syntax highlight mode for PO file syntax.
* [http://translate.sourceforge.net/wiki/virtaal/index Virtaal] - cross-platform PO editor that is clean, simple to use yet powerful.


And last but not least, [http://www.gnu.org/software/gettext/manual/ gettext] utils, which are installed on every linux distribution. You can see a complete reference too from installed info pages by running the command:
<!--


  info gettext
== Windows installer ==


== A few important things to remember ==
# Get the file according to your language [https://gitlab.com/inkscape/inkscape/tree/master/packaging/win32/languages here]. If there's no such file, copy the ‘English.nsh’ file and rename it to ‘YourLanguage.nsh’ (make sure someone updates the file [https://gitlab.com/inkscape/inkscape/blob/master/packaging/win32/languages/_language_lists.nsh _language_lists.nsh] in this case).
# Translate the strings in the file.
# Change/update header information in ‘YourLanguage.nsh’ (language name, [https://msdn.microsoft.com/en-us/goglobal/bb895996.aspx locale ID] and authors list) to proper values.
# Save the file. (Translation files should always use Unicode, encoded as UTF8!).
# Optionally, test your translation as described below.
# [[Translation information#Submit finished work|Submit your work]] (specify whether you tested it or not).


* Some strings that can be ambiguous or having several meanings according to different contexts may have a context prefix : "Context|Amibiguous string". In this case, simply translate "Ambiguous string", the "Context|" string is just a not to translate indication. (Some info on how to disambiguate a string can be found [http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS here].)
=== Test ===
* After translating a fuzzy string (one that is marked with a ", fuzzy" comment), please remove its "fuzzy" tag -- otherwise this translation will be discarded by the build process, meaning that this string will show up untranslated. KBabel can do this automatically (see KBabel settings).
* Before publishing your work (after you have finished updating the PO file), please update the "PO-Revision-Date" and "Last-Translator" fields in the PO file header. KBabel can do this automatically.


== Review ==
# [[Compiling Inkscape|Compile Inkscape]] (you'll probably want to [[Compiling Inkscape on Windows|Compile Inkscape on Windows]]) and run <code>make install</code> to create the binary distribution directory of Inkscape.
# Install [http://nsis.sourceforge.net/Main_Page NSIS].
# Right-click on the ‘inkscape.nsi’ file and choose ‘Compile NSIS Script’. The installer compilation will start.
# When the installer is ready, run it to test your translations for the installer and the uninstaller.


This is the start of a list of places to get translation reviews done.  So far:
== Default template ==
  http://www.linux.it/tp/


== Verification ==
To translate the default template:
* Modify the ‘default.svg’ file and save it as ‘default.xx.svg’ where ‘xx’ is the ISO code of your language. You will find the current template [https://gitlab.com/inkscape/inkscape/tree/master/share/templates here].
* Modify your PO translation to use your localized default template. Look up for a ‘default.svg’ string and translate it accordingly to the file name of the localized template.
* To test your template, save it as well as the compiled PO file (.mo) to the proper location for your system and restart Inkscape. New documents should now be based on your localized template (this is valid if your system is properly set to your locale).
* [[Translation information#Submit finished work|Submit your work]].


Before submitting your file in the patch tracker, please make sure it is valid:
To translate the default template, you can use Inkscape as well as any UTF-8 encoding capable text editor.
* Make sure the file is encoded in UTF-8  
* Make sure it is a valid po file and obtain some statistics about it: simply run "msgfmt --statistics -cv translationFile.po" from a command window
* Make sure it is correctly formatted: run "check-markup translationFile.po" from a command window and verify it doesn't output any error message. "check-markup" perl script can be found in the /po directory of Inkscape svn trunk


== Locale Testing ==
-->


Before reporting that a locale doesn't work in Inkscape, you need to make sure that your system has that locale correctly set up.  To do this, you need to generally find a way to run "locale-gen".  (Under Debian/Ubuntu this is via "dpkg-reconfigure locales".)  If you set both the LANG and LANGUAGE variables and check a regular tool, you should see the correct language for both the libc error (first line) and the tool error (second line):
[[Category:Translation]]
 
LANG=es_MX LANGUAGE=es_MX ls -z
ls: opci&oacute;n inv&aacute;lida -- z
Pruebe `ls --help' para m&aacute;s informaci&oacute;n.
 
If it reports the regular C messages, your locale has not been correctly configured, and you'll need to find the right way to run "locale-gen" for your distribution:
 
LANG=es_ES LANGUAGE=es_MX ls -z
ls: invalid option -- z
Try `ls --help' for more information.
 
== Submit finished work ==
 
Upload your work via the [[Launchpad]] bug tracker:
 
    https://bugs.launchpad.net/inkscape/
 
Report a new bug and attach your translated file to it. Don't forget to compress your file before uploading it.
 
Additionally, you may send a message to Inkscape's translators mailing list.
 
== Programmers ==
Please make sure you use [http://www.gnu.org/software/gettext/manual/html_mono/gettext.html#SEC150 dgettext] for any pluralized strings.
 
= Windows installer translation =
 
Strings for Windows installer are saved in *.nsh files. Each translation has its own file located in ''packaging\win32\'' directory of subversion checkout. Get this file in similar way of getting *.po file.
=== Translating ===
# Get the file according to your language. If there is not such a file, copy ''english.nsh'' file and rename it to ''yourlanguage.nsh''.
# Translate strings in the file
# Change header information in '''yourlanguage.nsh''' file (language name, [https://msdn.microsoft.com/en-us/goglobal/bb895996.aspx local ID], [https://msdn.microsoft.com/en-us/goglobal/bb964654 windows code page] and authors list) to proper values.
 
=== Testing the translation ===
# This part is optional but recommended. For this part you need [http://nsis.sourceforge.net/Main_Page NSIS installer] and run <pre>make -f Makefile.mingw dist</pre> command after succesfull compilation of Inkscape. This command prepares binary of Inkscape for installator creation.
# Add filename of your file to '''inkscape.nsi''' file, "STRING LOCALIZATION" section, "Language files" subsection.
# Right click on the inkscape.nsi file and choose "Compile NSIS Script". The installer compilation will start.
# When the installer is finished, run it to test translations of strings in Installer and Uninstaller parts.
# If the translation is tested succesfully, submit it to the patch tracker at sourceforge.net and mark as "Translation". If you haven't tested your translation yet, submit it too but enter this information to the patch information. You will be contacted about its correctness.
 
= Default template translation =
 
* To translate default template, modify the default.svg file and save it as default.xx.svg where "xx" is ISO code of your language. The file can be found in ''/usr/share/inkscape/templates/'' directory on Linux, or ''C:\Program Files\Inkscape\share\templates\'' directory on MS Windows(tm). Also you can get it from [http://svn.sourceforge.net/viewcvs.cgi/inkscape/inkscape/trunk/share/templates/ SVN repository].
* You need to modify your PO translation as well to use your localized default template. Look up for a msgid "default.svg" on the PO file and translate it accordingly to the file name of the localized template.
* To test it, save it to the proper location and restart Inkscape. Default document should be now based on your localized template. (This is valid if your system is properly set to your locales).
* Upload default.xx.svg to the patch tracker.
 
To translate default template can be used Inkscape as well as any UTF-8 encoding capable text editor.
 
= Translation information =
Go Back to the main [http://wiki.inkscape.org/wiki/index.php/Translation_information Translation information] page.

Latest revision as of 18:43, 6 June 2023

Go back to the main Translation information page.

Main translation files

1. Coordinate

As there may be other persons also currently working on the translation to your language, as a first step, please let your colleagues on the translators mailing list know that you'd like to start working on your language's translation, and coordinate your efforts (e.g. divide the work, set up a review system, … ). You can also check the mailing list archives to see whether there may be others who have started working on it recently. You can also ask for help finding previous translators for your language in the chat, to join their team.

2. Get the file

Get the most up-to-date translation files from GitLab's automatic builds:

For the main development branch: https://gitlab.com/inkscape/inkscape/-/jobs/artifacts/master/download?job=translations

For release branches: https://gitlab.com/inkscape/inkscape/-/jobs/artifacts/<branch name>/download?job=translations

The name of the release branch is usually something like '1.0.x' or '1.1.x'. You can ask on the mailing list or in the chat which branch is the current translation target.

In some cases, this will give a 'Page not found' error. In that case, visit the main Inkscape repository page on GitLab, select the correct branch at the top, then on the right side, click on the download icon and select to download the 'translations' artifact.

Unzip the downloaded file and select the po file for your language from it.

3. Translate

Translate the file for your language from the archive above with your favorite translation software.

Tip: if you encounter a case where, in the English text, the order of formatting arguments (numbers or text snippets that will be inserted into the string when the program runs) is different from the order in your language, and the arguments are not numbered in the original string, you can try this.

4. Test

  1. Make sure you have the release of Inkscape you are translating installed. If you're translating the coming release, pick a pre-release and compile it.
  2. Compile your PO file to .mo. Some translation tools (e.g. Poedit) have an option for that.
  3. Find and replace your language's .mo file. It is a file named ‘locale/your_language/LC_MESSAGES/inkscape.mo’, in the directory listed under Edit > Preferences > System > Inkscape Data in Inkscape.
    Note: This will not work with the snap, .dmg, AppImage or flatpak version of Inkscape, but only with a version that has been properly installed on your system and with extracted binary archives (zip files for Windows) or self-compiled versions. In some cases, you may need administrator privileges to edit files in said directory.
  4. Rename the original inkscape.mo file to inkscape.mo.bak and save your compiled .mo file into its place as inkscape.mo instead
  5. Then start Inkscape and you'll see your strings!

5. Get a GitLab account

If you don't have an account yet, now is the time to create one

6. Exchange the file on GitLab

For Inkscape 1.3.x, visit https://gitlab.com/inkscape/inkscape/-/blob/1.3.x/po/<your_locale>.po

For the main development branch, go to https://gitlab.com/inkscape/inkscape/-/blob/master/po/<your_locale>.po

Click on the "Replace" button and upload your translated file.

Enter your commit message below (something like "Update <your_locale>"). Choose a name for your branch. Do not use the same name as the target branch, but something like 'es_translations_for_1.3'.

7. Make a merge request

Click on the "Create merge request" button.

In the form, check 'Allow commits from members who can merge to the target branch' and also 'squash commits'.

Submit the merge request.