laravel-localization-loader icon indicating copy to clipboard operation
laravel-localization-loader copied to clipboard

How to best deal with translations in subfolders

Open chilio opened this issue 7 years ago • 3 comments

Here is what I do: 'en.auth-message': require('../../../resources/lang/en/auth/message.php'),and thenlang.get('auth-message.translation')which works. However doing this:en.auth/message': require('../../../resources/lang/en/auth/message.php'),and thenlang.get('auth/message.translation') or laravel conventionlang.get('auth.message.translation')` does not translate Any indeas on how to best deal with this?

chilio avatar Aug 04 '18 21:08 chilio

same issue :(((

i have 'en.front.addresses': require('../../../../lang/en/front/addresses.php')

and lang.get('front.addresses.delete.buttons.cancel'),

mojtabaRKS avatar Oct 22 '19 09:10 mojtabaRKS

after 2 hours problem solved !

i made my messages.js like this : 'en.front.addresses': require('../../../../lang/en/front/addresses.php'),

and in my code lang.get('front/addresses.delete.buttons.cancel'),

this is working like laravel localization ! i think this case should added to documentation like below :

subfolder :

in message.js '{locale}.{subfolder}.{file}': require('../../../../lang/{locale}/{subfolder}/{file}.php')

and in your code : lang.get('{subfolder}/{file}.foo.bar'), same for more sub folders : lang.get('{subfolder1}/{subfolder2}/{subfolder3}/.../{file}.foo.bar'),

@chilio @rmariuzzo

mojtabaRKS avatar Oct 22 '19 10:10 mojtabaRKS

Can you create a PR, please?

rmariuzzo avatar Oct 22 '19 17:10 rmariuzzo