codekingpro/portable-devtools
114k
1Translations2============3 4WTForms uses gettext to provide translations. Translations for various5strings rendered by WTForms are created and updated by the community. If6you notice that your locale is missing, or find a translation error,7please submit a fix.8 9 10Create11------12 13To create a translation, initialize a catalog in the new locale:14 15```16$ pybabel init --input-file src/wtforms/locale/wtforms.pot --output-dir src/wtforms/locale --domain wtforms --locale <your locale>17```18 19This will create some folders under the locale name and copy the20template.21 22Update23------24 25To add new translatable string to the catalog:26 27```28pybabel extract --copyright-holder="WTForms Team" --project="WTForms" --version="$(python -c 'import wtforms; print(wtforms.__version__)')" --output-file src/wtforms/locale/wtforms.pot src/wtforms29```30 31Edit32----33 34After creating a translation, or to edit an existing translation, open35the ``.po`` file. While they can be edited by hand, there are also tools36that make working with gettext files easier.37 38Make sure the `.po` file:39 40- Is a valid UTF-8 text file.41- Has the header filled out appropriately.42- Translates all messages.43 44 45Verify46------47 48After working on the catalog, verify that it compiles and produces the49correct translations.50 51```52$ pybabel compile --directory src/wtforms/locale --domain wtforms --statistics53```54 55Try loading your translations into some sample code to verify they look56correct.57 58 59Submit60------61 62To submit your translation, create a pull request on GitHub.63 