Difference between revisions of "Interface translation"

From Inkscape Wiki
Jump to navigation Jump to search
(18 intermediate revisions by 4 users not shown)
Line 1: Line 1:
Go back to the main [[Translation information]] page.
Go back to the main [[Translation information]] page.


== Main translation file ==
== Main translation files ==


See [[Translation information#PO translation files|here]] to get information about how to deal with PO files.
=== 1. Get the file ===
Get the most up-to-date translation files from GitLab's automatic builds:


=== Get the PO file for your language ===
For the 1.0.x branch:
https://gitlab.com/inkscape/inkscape/-/jobs/artifacts/1.0.x/download?job=translations


Download the .po file for your language from [http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/files/head:/po/ here].
For the main development branch:
https://gitlab.com/inkscape/inkscape/-/jobs/artifacts/master/download?job=translations


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.
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.
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 [http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/annotate/head:/po/inkscape.pot here].
Unzip the downloaded file and select the po file for your language from it.


Alternatively, you can checkout the full Bazaar project repository and generate the project template. Information on how to get the source tree can be found [https://inkscape.org/develop/inkscape-bzr/ here]. Then, you have to follow some steps in order to generate the template:
=== 2. Translate ===


# <code>./autogen.sh</code>
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].
# <code>./configure</code>
# Enter the ‘po’ directory: <code>cd po</code>
# Generate the current PO template: <code>intltool-update --pot</code>


To make an absolutely up-to-date translation (in case the PO file in bzr is not up-to-date enough):
=== 3. Test ===


# Update your local copy of Inkscape in the usual way: <code>bzr pull</code>
# 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.
# Merge your existing translations into the new POT file (inkscape.pot):<br/> <code>msgmerge your_latest_PO_file inkscape.pot > new_PO_file</code>
# 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!


If you want to update ALL .po files in po/, cd there and run:
=== 4. Get a GitLab account ===
<pre>
make update-po
</pre>


Now that you have an empty PO template, you can start translating the messages.
If you don't have an account yet, now is the time to [https://gitlab.com/users/sign_up create one]


=== Locale Testing ===
=== 5. Exchange the file on GitLab ===


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 <code>dpkg-reconfigure locales</code>). 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):
For Inkscape 1.0.x, visit
<code><nowiki>https://gitlab.com/inkscape/inkscape/-/blob/1.0.x/po/<your_locale>.po</nowiki></code>


<pre>
For the main development branch, go to
LANG=es_MX LANGUAGE=es_MX ls -z
<code><nowiki>https://gitlab.com/inkscape/inkscape/-/blob/master/po/<your_locale>.po</nowiki></code>
ls: opción inválida -- z
Pruebe `ls --help' para más información.
</pre>


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:
Click on the "Replace" button and upload your translated file.


<pre>
Enter your commit message below (something like "Update <your_locale>").
LANG=es_ES LANGUAGE=es_MX ls -z
ls: invalid option -- z
Try `ls --help' for more information.
</pre>


=== Submit finished work ===
=== 6. Make a merge request ===


Upload your work via the [https://bugs.launchpad.net/inkscape/ Launchpad bug tracker]. Report a new bug and attach your translated file to it. Don't forget to compress your file before uploading it.
Click on the "Create merge request" button.


Additionally, you may send a message to Inkscape's translators mailing list.
In the form, check 'Allow commits from members who can merge to the target branch' and also 'squash commits'.
 
Submit the merge request.
 
<!--


== Windows installer ==
== Windows installer ==


# Get the file according to your language [http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/files/head:/packaging/win32/languages/ here]. If there is not such a file, copy the ‘English.nsh’ file and rename it to ‘YourLanguage.nsh’.
# 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 strings in the file.
# Translate the 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.
# 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).


=== Testing the translation ===
=== Test ===


This part is optional but recommended.
# [[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].
# Install [http://nsis.sourceforge.net/Main_Page NSIS].
# Run the <code>make -f Makefile.mingw dist</code> command after successful compilation of Inkscape. This command prepares binary of Inkscape for installer creation.
# Add the filename of your file to the ‘inkscape.nsi’ file (in the parent folder) in the <code>; Localization</code> section (with other languages).
# Right-click on the ‘inkscape.nsi’ file and choose ‘Compile NSIS Script’. The installer compilation will start.
# 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 your translations for the installer and the uninstaller.
# When the installer is ready, run it to test your translations for the installer and the uninstaller.
# If the translation is tested successfully, submit it to the [https://bugs.launchpad.net/inkscape/ Launchpad bug tracker] and mark as ‘Translation’.
 
If you submit your translation but haven't tested it yet, enter this information to the patch information. You will be contacted about its correctness.


== Default template ==
== Default template ==


* 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 [http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/files/head:/share/templates/ here].
To translate the default template:
* You need to modify your PO translation as well to use your localized default template. Look up for a <code>msgid "default.svg"</code> on the PO file and translate it accordingly to the file name of the localized 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].
* 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).
* 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.
* Upload default.xx.svg to the patch tracker.
* 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]].


To translate the default template, you can use Inkscape as well as any UTF-8 encoding capable text editor.
To translate the default template, you can use Inkscape as well as any UTF-8 encoding capable text editor.
-->


[[Category:Translation]]
[[Category:Translation]]

Revision as of 21:40, 17 August 2020

Go back to the main Translation information page.

Main translation files

1. Get the file

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

For the 1.0.x branch: https://gitlab.com/inkscape/inkscape/-/jobs/artifacts/1.0.x/download?job=translations

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

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.

2. Translate

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

3. 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!

4. Get a GitLab account

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

5. Exchange the file on GitLab

For Inkscape 1.0.x, visit https://gitlab.com/inkscape/inkscape/-/blob/1.0.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>").

6. 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.