-
Notifications
You must be signed in to change notification settings - Fork 78
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
Added multi-line support #95
base: master
Are you sure you want to change the base?
Conversation
Added support for multiple strings for localization, ex. …. "message" : [ "line 1 to", "line 2 of message", "line 3 of message" ], ….
@@ -201,7 +201,7 @@ angular.module('ngLocalize') | |||
} | |||
|
|||
function applySubstitutions(text, subs) { | |||
var res = text, | |||
var res = (text instanceof Array ? text.join('') : text), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use angular.isArray instead
Can u provide the use case? Why should the message be joined at runtime? |
Used angular.isArray instead of 'instanceof'
Some special cases we have on our localization for an application from english to spanish, in spanish some sentences are longer and in our case made more ease (for reading) to have multiple 'lines' on the json instead of a long string. You may say the editor has some times the 'wrap words' function, however it helped us (made it more easy to check). Believe it is something that may be useful for somebody else. |
@@ -201,7 +201,7 @@ angular.module('ngLocalize') | |||
} | |||
|
|||
function applySubstitutions(text, subs) { | |||
var res = text, | |||
var res = (angular.isArray(text) ? text.join('') : text), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it will be more intuitive to join with a space.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the use case presented for the split if we want to split "this is a very long string to be splitted in two" we can split in [ "this is a very long string ","to be splitted in two" ] and after the join the string will be "this is a very long string to be splitted in two" if the join is an space it will become "this is a very long string to be splitted in two" with a double space between "string" and "to"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's weird to have trailing whitespace in strings you wish to join, is there a specific reason why you can't remove the whitespace from your string array in the json and let the joiner do the work? I think that's the 99% use case anyway.
Added support for multiple strings for localization, ex.
….
"message" : [ "line 1 to",
"line 2 of message",
"line 3 of message" ],
….
This change is