Wed, 20 Jan 2021 10:17:01 +0100
updated pronterface.py losing my own changes
15 | 1 | |
2 | Printrun Internationalization | |
3 | ||
4 | Date: 06 August 2011 | |
5 | Author: Jonathan Marsden <jmarsden@.fastmail.fm> | |
6 | ||
7 | Printrun is in the very early stages of being internationalized. | |
8 | ||
9 | The pronterface.py now uses gettext for the messages it generates. | |
10 | The corresponding pronterface.pot file is at locale/pronterface.pot | |
11 | and was generated using | |
12 | ||
13 | pygettext -o locale/pronterface.pot *.py printrun/*.py printrun/*/*.py | |
14 | ||
15 | followed by minor edits to the generated header. | |
16 | ||
17 | This template is the basis for all pronterface mesage catalogs. Right | |
18 | now there is only one, for German. New ones can be created: | |
19 | ||
20 | # Create new pronterface message catalog for a different language | |
21 | newlang="es" # use the correct code for your language | |
22 | mkdir -p locale/${newlang}/LC_MESSAGES | |
23 | cp locale/pronterface.pot locale/${newlanguage}/LC_MESSAGES/pronterface.po | |
24 | cd locale/${newlanguage}/LC_MESSAGES/ | |
25 | # Edit the .po file to add messages for newlang | |
26 | msgfmt -o pronterface.mo pronterface.po | |
27 | ||
28 | To update a previously created message catalog from the template, use : | |
29 | ||
30 | msgmerge -U locale/fr/LC_MESSAGES/pronterface.po locale/pronterface.pot | |
31 | ||
32 | As currently coded, the default location for these message catalogs is | |
33 | ||
45 | 34 | /usr/share/locale/ |
15 | 35 | |
36 | So, to install the catalogs, copy them to there: | |
37 | ||
45 | 38 | sudo cp -a locale /usr/share/ |
15 | 39 | |
40 | To test pronterface in a new language, you can temporarily set LANG to | |
41 | the language you are testing, for example | |
42 | ||
45 | 43 | LANG=de.UTF-8 python pronterface.py |
15 | 44 | |
45 | Further automation for localization and packaging of Printrun would be | |
46 | nice to see, but is not here yet. | |
47 |