Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>1) use _() (or gettext()) in your code and templates. Translated strings set in the module globals or class definitions should use some form of lazy gettext(), because i18n won't be available when the modules are imported.</p> <p>2) Extract all translations using pybabel. Here we pass two directories to be scanned: the templates dir and the app dir. This will create a messages.pot file in the /locale directory with all strings found in these directories. babel.cfg is the extraction configuration that varies depending on the template engine you use:</p> <pre><code>$ pybabel extract -F ./babel.cfg -o ./locale/messages.pot ./templates/ ./app/ </code></pre> <p>3) Initialize a directory for each language. This is done only once. Here we initialize three translations, en_US, es_ES and pt_BR, and use the messages.pot file created on step 2:</p> <pre><code>$ pybabel init -l en_US -d ./locale -i ./locale/messages.pot $ pybabel init -l es_ES -d ./locale -i ./locale/messages.pot $ pybabel init -l pt_BR -d ./locale -i ./locale/messages.pot </code></pre> <p>Translate the messages. They will be in .mo files in each translation directory. After all locales are translated, compile them:</p> <pre><code>$ pybabel compile -f -d ./locale </code></pre> <p>Later, if new translations are added, repeat step 2 and update them using the new .pot file:</p> <pre><code>$ pybabel update -l pt_BR -d ./locale/ -i ./locale/messages.pot </code></pre> <p>Then translate the new strings and compile the translations again.</p> <p>4) The strategy here may vary. For each request you must set the correct translations to be used, and probably want to cache loaded translations to reuse in subsequent requests.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload