richardoctoey - 5 months ago

Hi guys, I guess that pyrocms is able to translate static words. because I watch it from here: https://pyrocms.com/videos/series/extending-pyrocms/overriding-translations

My problem is: I want to write down translate-able static words. So in the view I put:

trans('wosh') then in the lang/en/addon.php I add return [ 'wosh' => 'wow', ];

but it print wosh, instead of wow. I'm sure that i'm in en locale, because i'm put http://localhost:8000/?_locale=en in the url and the content return the english content. I think I am doing it wrong, thanks for help.

Answer

ryanthompson - 5 months ago

Hey there! All translations need to be namespaced. So for example something like this will work:

{{ trans('your_company.module.example_addon::addon/wosh') }} 

ryanthompson - 5 months ago

Hey there! All translations need to be namespaced. So for example something like this will work:

{{ trans('your_company.module.example_addon::addon/wosh') }} 

edster - 5 months ago

DAMMIT, your login redirect made you faster!

richardoctoey - 5 months ago

@ryanthompson hi if it was in the theme let's say I was made it with: php artisan make:addon myname.theme.mythemename then it should be {{ trans('myname.theme.mythemename::addon/wosh') }} is that correct? because it just write myname.theme.mythemename::addon/wosh in the view

ryanthompson - 5 months ago

addon.wosh should do it

ryanthompson - 5 months ago

Laravel's finders for views / lang / config behave a little different with / vs ..

richardoctoey - 5 months ago

to people out there searching for language translation for static word you use this:

{{ trans('your_company.module.example_addon::addon.wosh') }} thanks ryan for your help