Closed gol4nsky closed 8 months ago
I think this is because
load_theme_textdomain('my_theme', get_template_directory() . '/resources/lang');
is called after the psr-4 class autoloader, which loads the block.
@Log1x - What is best practise for that? I have the same problem like @gol4nsky when I define fields like that:
public function fields()
{
$bootstrapContainer = new FieldsBuilder('bootstrap_container');
$bootstrapContainer
->addSelect(
'width',
[
'choices' => [
'default' => __('Default', 'my_theme'),
'full' => __('Full width', 'my_theme')
]
]
)
(...)
It works if I put load_theme_textdomain
into the fields()
function, but this is not really a good solution
Update:
I put this code in functions.php of my sage theme:
/*
|--------------------------------------------------------------------------
| Load theme textdomain
|--------------------------------------------------------------------------
|
| Needs to be loaded before Auto Loader to have translations available in
| autoloader classes
|
*/
load_theme_textdomain('mytheme', get_template_directory() . '/resources/lang');
What do you think? Is this a good idea?
Hi, Is there any solution with localization ? Using --construct and everything according to this https://roots.io/sage/docs/localization/#localization, the strings still appear in the originally encoded language and not translated.