Localization Guide
The purpose of this guide is to describe how to contribute to the Orca Slicer translations. We use GNU gettext
for extracting string resources from the project and PoEdit for editing translations.
The required software can be found at the following links:
- PoEdit provides good interface for the translators
- GNU
gettext
package contains a set of tools to extract strings from the source code and to create the translation Catalog- After
gettext
is installed, it is recommended to ensure the gettext bin is in yourPATH
variable - The full manual page for
gettext
can be found here
- After
How do I add a translation or fix an existing translation
Get PO-file OrcaSlicer_xx.pot
from corresponding sub-folder here.
Open this file in PoEdit as "Edit a translation"
Apply your corrections to the translation
Push changed OrcaSlicer_xx.po
into the original folder
Copy OrcaSlicer_xx.mo
into resources/i18n/xx
and rename it to OrcaSlicer.mo
, then push the changed file.
How do I add a new language support
- Get file OrcaSlicer.pot here
- Open it in PoEdit for "Create new translation"
- Select Translation Language (for example French).
- As a result you will have fr.po - the file containing translation to French.
Notice. When the translation is complete you need to:
- Rename the file to OrcaSlicer_fr.po
- Click "Save file" button. OrcaSlicer_fr.mo will be created immediately
Bambu_Studio_fr.po
needs to be copied into the sub-folderfr
of this directory, and be pushed- copy
OrcaSlicer_xx.mo
intoresources/i18n/xx
and rename it toOrcaSlicer.mo
, then push the changed file.- Note: "fr" means "French" - the translation language
How do I add a new text resource when implementing a feature to Orca Slicer
Each string resource in Orca Slicer available for translation needs to be explicitly marked using L() macro like this:
To get translated text use one of needed macro/function (_(s)
or _CHB(s)
).
If you add new file resource, add it to the list of files containing macro L()
How do I use gettext
to localize my own application taking Orca Slicer as an example
For convenience create a list of files with this macro L(s)
. We have https://github.com/softfever/OrcaSlicer/blob/master/localization/i18n/list.txt.
Create template file(*.POT
) with gettext
command:
Use flag --from-code=UTF-8
to specify that the source strings are in UTF-8 encoding
Use flag --debug
to correctly extract formatted strings(used %d, %s etc.)
Create PO- and MO-files for your project as described above.
To merge old PO-file with strings from created new POT-file use command:
Use option -N
to not using fuzzy matching when an exact match is not found.
To concatenate old PO-file with strings from new PO-file use command:
Create an English translation catalog with command:
Notice, in this Catalog initially they will be the same strings for initial text and the translated text.
When you have the Catalog to translation created, open the .pot
or .po
file in PoEdit and start translating.
General Guidelines
-
We recommend using PoEdit application for translation (as described above). It will help you eliminate most punctuation errors and will show you strings with "random" translations (if the fuzzy parameter was used).
-
To check how the translated text looks on the UI elements, test it :) If you use PoEdit, all you need to do is save the file. At this point, a MO file will be created. Rename it Orca Slicer.mo, and you can run Orca Slicer (see above).
-
If you see an encoding error (garbage characters instead of Unicode) somewhere in Orca Slicer, report it. It is likely not a problem of your translation, but a bug in the software.
-
See on which UI elements the translated phrase will be used. Especially if it's a button, it is very important to decide on the translation and not write alternative translations in parentheses, as this will significantly increase the width of the button, which is sometimes highly undesirable:
-
If you decide to use autocorrect or any batch processing tool, the output requires very careful proofreading. It is very easy to make it do changes that break things big time.
-
Any formatting parts of the phrases must remain unchanged. For example, you should not change
%1%
to%1 %
, you should not change%%
to%
(for percent sign) and similar. This will lead to application crashes. -
Please pay attention to spaces, line breaks (\n) and punctuation marks. Don't add extra line breaks. This is especially important for parameter names.
-
Description of the parameters should not contain units of measurement. For example, "Enable fan if layer print time is less than
n seconds" -
For units of measurement, use the international system of units. Use "s" instead of "sec".
-
If the phrase doesn't have a dot at the end, don't add it. And if it does, then don't forget to :)
-
It is useful to stick to the same terminology in the application (especially with basic terms such as "filament" and similar). Stay consistent. Otherwise it will confuse users.
Last updated on