Dojo Globalization and nls keys

I have a DOJO nls key file that has entries like

({

"name":"test",
"comma" : ", ",
"hello":"Hello",
"welcome_msg": this.name+this.comma+this.hello

})

      

I want the welcome message to be there "Hello, test"

, so basically want to use the name, comma and welcome key above in this value field and create a string, not direct use.

Is there a way to achieve the above type this.comma

or $ {comma}? mostly on stands in French and other languages, and some of the spl characters will have extra space before and after, and in English only one space after ...

any help in this regard would be much appreciated. thank

+3


source to share


1 answer


I am using dojo.replace. But I am using this in the widget code and not in the actual nls file.

var i18n = ...
var name = ...
dojo.replace('{0}{1} {2}', [i18n.hello, i18n.comma, name]);

      

BUT, I don't understand how this helps with what you are trying to accomplish. Why not leave a welcome message like



"welcome_msg": "Hello, {0}"

      

The nls file matches the language, so any other nls file will have the appropriate punctuation and spacing that you need.

+2


source







All Articles