Created
November 24, 2015 10:30
-
-
Save cstrap/2c4e5b03c0dfe3621571 to your computer and use it in GitHub Desktop.
A way to generate localization files :: Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Creating Template | |
| $ find . -iname "*.py" -exec xgettext -o messages.pot {} \; | |
| # Copy template message.pot into locale/XX/LC_MESSAGES | |
| # For example (this is a typical django app tree structure) | |
| ... | |
| │ ├── locale | |
| │ │ ├── en | |
| │ │ │ └── LC_MESSAGES | |
| │ │ │ ├── django.mo | |
| │ │ │ └── django.po | |
| │ │ └── it | |
| │ │ └── LC_MESSAGES | |
| │ │ ├── django.mo | |
| │ │ └── django.po | |
| $ cp message.pot locale/en/LCMESSAGES/django.po | |
| # Edit the django.po file with an editor | |
| $ vi django.mo | |
| # Compiling .mo file | |
| $ msgfmt -o django.mo django.po | |
| # Resources | |
| # https://pymotw.com/2/gettext/ | |
| # http://stackoverflow.com/questions/739314/easiest-way-to-generate-localization-files |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment