Skip to content

Sage Docs

Localization

Generating language files

  1. Open package.json and add a script for generating language files:
  1. Run yarn pot from your theme directory to generate the language files. In case of an error, install/update coreutils, findutils and/or gettext on homebrew.

  2. Open the generated .pot file with Poedit, select "Create new translation", save .mo & .po files in the resources/lang folder with the correct name syntax (eg. fr_FR, en_US)

When adding/removing translations in templates, run yarn pot again, then select "Catalog > Update from a POT file" in Poedit.

Loading language files

Add the following to app/setup.php:

Make sure language files exist in the resources/lang directory.

Polylang and Sage

Need to also translate strings from the app/ folder? See Sage_Polylang_Theme_Translation.

Contributors

Last updated

Support Roots

Help us continue to build and maintain our open source projects. We’re a small team of independent developers and every little bit helps.

Sponsor Roots on GitHub