Translation For Static Words
Created 6 years ago by richardoctoey

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.

ryanthompson  —  6 years ago Best Answer

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  —  6 years ago

DAMMIT, your login redirect made you faster!

richardoctoey  —  6 years 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  —  6 years ago

addon.wosh should do it

ryanthompson  —  6 years ago

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

richardoctoey  —  6 years 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