Skip to content
Sage
v10.8.2
  • Sage page

Localization

# Generating language files

Run yarn translate:pot from your theme directory to generate the language files. Then 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 translate:update, then select "Catalog > Update from a POT file" in Poedit.

# Loading language files

Add the following to app/setup.php:

add_action('after_setup_theme', function () {
    load_theme_textdomain('sage', get_template_directory() . '/resources/lang');
});

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