rmariuzzo / laravel-localization-loader

Laravel Localization loader for webpack. Convert Laravel Translation strings to JavaScript Objects.
MIT License
70 stars 7 forks source link

How to best deal with translations in subfolders #7

Open chilio opened 6 years ago

chilio commented 6 years ago

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?

mojtabaRKS commented 5 years ago

same issue :(((

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

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

mojtabaRKS commented 5 years ago

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

rmariuzzo commented 5 years ago

Can you create a PR, please?