|
| 1 | +Dependencies |
| 2 | +============ |
| 3 | +babel (http://babel.edgewall.org/) |
| 4 | + (pip install babel) |
| 5 | + |
| 6 | +Internationalization |
| 7 | +==================== |
| 8 | +bPython delegates to babel most of the job for creating .po and .mo files, so |
| 9 | +you may want to check also its documentation for more informations |
| 10 | +http://babel.edgewall.org/wiki/Documentation/0.9/index.html . |
| 11 | + |
| 12 | +In order to create a new language translation, first of all you need to know |
| 13 | +that translations follow this path template: i18n/locale/<locale>/LC_MESSAGES/bpython.po |
| 14 | + |
| 15 | +To create a new template .po file, you just need to follow 4steps: |
| 16 | + 1. Set up the correct directory structure: |
| 17 | + |
| 18 | + $ mkdir i18n/locale/fo_FO/ # assuming fo_FO is your desidered locale |
| 19 | + $ mkdir i18n/locale/fo_FO/LC_MESSAGES |
| 20 | + |
| 21 | + 2. Extract messages from the source using babel: |
| 22 | + |
| 23 | + $ python setup.py extract_messages -o i18n/locale/fo_FO/LC_MESSAGES/bpython.po |
| 24 | + running extract_messages |
| 25 | + extracting messages from bpdb/__init__.py |
| 26 | + extracting messages from bpdb/debugger.py |
| 27 | + extracting messages from bpython/__init__.py |
| 28 | + ... |
| 29 | + writing PO template file to i18n/locale/fo_FO/LC_MESSAGES/bpython.po |
| 30 | + |
| 31 | + 3. Edit bpython.po |
| 32 | + |
| 33 | + 4. Compile the bpython.po file jsut created using babel: |
| 34 | + $ python setup.py compile_catalog -f |
| 35 | + running compile_catalog |
| 36 | + compiling catalog 'i18n/locale/fo_FO/LC_MESSAGES/bpython.po' to 'i18n/locale/fo_FO/LC_MESSAGES/bpython.mo' |
| 37 | + |
| 38 | +bPython will take care to install generated locales to /usr/share/locale, so |
| 39 | +just type |
| 40 | + $ python setup.py install |
| 41 | +to enjoy internationalization! |
| 42 | + |
0 commit comments