-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Returning array #67
Comments
I had a short look in the source code.
I guess it's enough to change the to typeof message conditionals with a simple !message |
@jonasgrosch I'm curious to know what would be the use case of having an array instead of string for a localization string? |
@rmariuzzo I use it for QA section for example. It makes it possible to have a different amount of questions/answers on different languages. In general i try to avoid using any 'language' in my code and centralize all around my localization files, because some of my projects lead to a high amount of wording changes and it's just way more easy to apply them this way. This leads to some use cases for array returning. |
Changing |
@andre-dw I got some edge cases where this solution leads to problems. My current overwrite for the function is the following:
|
It's better verify if the message is an object:
In my case sometimes I use an object for a select, iterate it and make the options. |
Will this every be implemented? |
You can get an array in this way: lang.messages[lang.locale + '.app'].myArray |
It would be nice if defining an array as an translation value would be possible. It'S possible inside laravel itself and im using it for this purpose.
If i define a value in Lang.js though it returns the key instead of the array.
The text was updated successfully, but these errors were encountered: