Localization
Generating language files
- Open
package.json
and add a script for generating language files:
- Run
yarn pot
from your theme directory to generate the language files. In case of an error, install/updatecoreutils
,findutils
and/orgettext
on homebrew.
- Open the generated
.pot
file with Poedit, select "Create new translation", save.mo
&.po
files in theresources/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
- Install BenjaminMedia/wp-polylang-theme-strings
- Replace
__()
withpll__()
in your templates
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