-
Notifications
You must be signed in to change notification settings - Fork 2
Language versions
AnyGrabber was created in English language and translated into Polish. It is easy to translate into other languages. The following page, after a brief introduction, will show you how to translate it into the language of your choice.
The programs' translation is stored in .pot
and .po
files. The .pot
file is generated based on translation strings found inside the code. Those are strings that start with the _
mark (for example _("Language")
). Those strings can then be automatically parsed to update the .pot
file as a base for language translations. Translation into other languages involves adding a single line of code to create a new menu entry and doing the actual translation using a simple interface provided by the Poedit program. We then add appropriate translations and save them into a .po
and .mo
files. The program automatically recognizes them, swapping the translation strings that start with _
with the actual translations.
The following guide assumes that you know how to clone the repo to your computer. If you need guidance on how to do this follow the official guide How to clone GitHub repository
- Download the free version of the open-source program called POEDIT. Install and run the program. After the successful installation, you should be greeted with a screen similar to the one shown below:
-
Choose
Browse files
option -
Locate the AnyGrabber folder, go to the
locale
directory, and open theMain.pot
file. Your screen should look similar to this one: -
If you made any changes to
_
strings inside the code, you can use theUpdate from code option
to load them into the program. -
Now you can create a new translation from this pot file by clicking the
Create a new translation
button that should be located on the bottom part of the window
-
Choose a new language that you would like to translate into, for example German.
-
Add the translations for texts - you can use the suggestions on the right side of a window
-
When done, click
file
menu and selectsave as
. -
Go to AnyGrabber
locale
folder and create a new folder with desired locale name - for examplede-DE
for German.
-
Inside
de-DE
directory create another folder calledLC_MESSAGES
. -
Save the file as
Main.po
-
Main.mo
file should be generated automatically. Refer to folder structure for other languages if you got lost on directory structure for new translation. -
Open the
locale_utils.py
file that is located insideutils
folder in AnyGrabbers' main directory -
Add a language mapping for your chosen language - for example `"de-DE": _("German")"
- Done - your new translation is ready - or is it?
-
As you might have noticed - the new translation is missing the new
_("German")
that we added to the mappings list. Therefore we need to update ourMain.pot
file from code. Open this file and refer to step 4 - click the update from code button. -
Your new translation string should be present on the list. Click the
save
button. -
Click the
open
button and go tode-DE
folder, thenLC_MESSAGES
and openMain.po
. -
When new Poedit window opens, go to
Translation
menu and chooseUpdate from POT file
.
-
Go back to
locale
folder inside AnyGrabber root. SelectMain.pot
file. -
Sources and translations list should reflect the newest changes to source file, update the translation for
German
, and click thesave
button.
- Done - your new translation is complete.