Introduction
- Poedit serves as a front-end to gettext. It allows you to edit catalog files in a comfortable way.
Where you can get Poedit from
How to setup Poedit for Python/wxPython
- Download Poedit from the above site and install it.
- Create a parser setup
- Start Poedit and select File/Preferences and create a new Parser on the Parsers tab with the following settings:
- Language = Python
- List of extensions = .py
- Parser command = C:\Python23\Python.exe C:\Python23\Tools\i18n\pygettext.py -o %o %K %F
- An item in keywords list = -k%k
- An item in inputs files list = %f
- Start Poedit and select File/Preferences and create a new Parser on the Parsers tab with the following settings:
Creating a new translation catalog
- Start Poedit and select File/New Catalog
- On the Project info tab enter the following:
- Enter the Project name, Team, and e-mail address
- Select the Language, e.g. German
- DO NOT select a Country unless you want to have country specific translations (in which case you have to setup your directory structure accordingly)
- Select a charset, e.g. utf-8
- On the Paths tab enter the following:
- Your base path, e.g. "C:\Dev" (where you keep all your development)
- Under paths enter the directory where your .\locale dir is, e.g. "ivcm"
- On the keywords tabs you don't need to enter anything assuming that you are using the _() macro for your translation strings.
- Press OK and save the catalog in the appropriate directory, e.g. "C:\Dev\ivcm\locale\de\LC_MESSAGE" and name it "ivcm.po"
- Poedit will automatically scan the directories you defined in step two and create the .po and .mo files.
- On the Project info tab enter the following:
Use the Catalog Manager for your translation projects
I would recommend to use the catalog manager, as it gives you fast and easy access to all your translation projects. If you do turn the following setting on, so Poedit starts with the Catalog Manager.
- Start Poedit and select File/Preferences and select
- Open catalogs manager on Poedit startup
- Create a project (in the catalog manager)
- Create the directory structure as explained on the previous page.
- Click on the icon "Create new translations project"
- Name the project, e.g. "ivcm"
- Define the directories per language (replace the ".\" with the full path name where you do your development for this project
- .\locale\en\LC_MESSAGES
- .\locale\fr\LC_MESSAGES
- .\locale\de\LC_MESSAGES
- Define the directories per language (replace the ".\" with the full path name where you do your development for this project
Updating .po and .mo files after you made source code changes
- Update from sources
- Start Poedit and select the appropriate project and language you want to work on, this will open the Poedit with the appropriate .po file
- Click on the wheel icon or select Catalog/Update from sources
- Review strings marked as "fuzzy" (yellow) or "not translated (greenish)
- When done save it and Poedit will create the .mo file (unless you changed your Preferences/Editor
Comments
Any suggestions to enhance this page are welcome. You can contact me at [werner.bruhin@free.fr]