I managed to get it working with those instructions!
Poedit
By default, Poedit cannot find strings to translate from Blade templates. Here is a list of parameters to add to your Poedit software preferences so it can detect translation strings from your Blade views:
- Open Poedit
- Go to Preferences -> Extractors
- Add a new Extractor with following settings:
- Language:
Blade
- Extension:
*.scout.php, *.blade.php
- Parser command:
xgettext --language=Python --add-comments=TRANSLATORS --force-po -o %o %C %K %F
- An item in keyword list:
-k%k
- An item in input files list:
%f
- Source code charset:
--from-code=%c
- Language:
- Click Ok
In order for this to work, you must have a poedit project correctly setup pointing to the languages
folder of either your theme or custom plugin and define the gettext methods and resources base path. From the catalog preferences, set the sources paths like so:
- Base path:
sage theme folder
- Paths:
-
.
-
- Excluded Paths:
-
node_modules/
-
vendor/
-
resources/assets/
-
as well as adding the following gettext methods to the source keywords catalog tab:
-
__
-
_e
-
_x
-
esc_html__
-
esc_html_e
-
_n
-
_nx
-
_n_noop
-
_nx_noop
-
_ex
and more if needed.