Bricks uses standard WordPress localization functions (opens new window) in its templates, such as
esc_html_e(), to prevent hardcoded text strings.
The default text domain (opens new window) is named
<?php esc_html_e('My translatable text string', 'bricks') ?>
Gulp scans template files for all localization functions that use
bricks as text domain, and updates the
languages/template.pot file, that you can use as a base for your translations (read more about this subject on WordPress developer's handbook (opens new window)).
To take advantage of this, you should use
bricks as text domain even for your own translatable strings.
*.mo translation files should be placed inside
languages/ folder as well, and can be generated with a tool like Poedit (opens new window).
Bricks' templates have English text strings by default, and already includes translations for the following languages:
- 🇨🇿 Czech
- 🇫🇷 French
- 🇩🇪 German
- 🇮🇹 Italian
- 🇱🇹 Lithuanian
- 🇪🇸 Spanish
Contributions to add translations for additional languages are kindly welcome, and could be a nice way to help improve this project. If you want to contribute you can open a pull request on the GitHub repository (opens new window).
The localization task is included only in
yarn build script, and not in
yarn dev or
yarn watch, to prevent updating
template.pot too often during active development.