Follow this guide Sage 10.x: Localization | Roots Documentation i installed gettext in WSL, i run yarn pot, i opened sage.pot with POedit, translate “Potrebbero interessarti anche” in “Related events”
add this code in app/setup.php
add_action('after_setup_theme', function () {
load_theme_textdomain('my-theme', get_template_directory() . '/lang');
});
Uploaded all files and folder but i still view only the source string non the translated version.
I use WPML with string translation.
Where am i wrong?
The POT file is only a template (T stands for template), you have to save a PO file and then save/compile that to a MO file, which is actually used by WordPress/PHP.
Also ensure you have the correct locale set up to be used by the site, and that the MO (and therefore also the source PO file) have the proper locale in the filename.
For example, for German formal translation I would have two files in the resources/lang/ directory, de_DE_formal.po and de_DE_formal.mo.
In case anyone else stumbles upon this.
WPML doesn’t compile the blade syntax properly, so you’ll have to use default php code.
In this case for example: