Bharath Shetty
Bharath Shetty

Reputation: 139

javascript parameter in localisation string

We are using strings for localisation support.

  1. Some of these have parameters for eg. "My name is {0} and I am version {1}.0."
  2. Another scenario is we have broken strings like "My blah blah is "+ "Yada Yada ..."+ "Tom, Harry ... are all pals"

Would these cause problems if we have to translate these to languages like japanese and chinese ?

Please note we have frequent releases and the translation guys id both as requiring much effort for every release.

Upvotes: 0

Views: 143

Answers (1)

RichieHindle
RichieHindle

Reputation: 281825

Using substitutions like {0} is often preferable because of word ordering.

To give a trivial example, the translation of something like "Please save the file" from English into German might look like "Please the file save". In that case the English string might be:

"Please {0} {1}"

while the German can be

"Bitte {1} {0}"

(Forgive my poor knowledge of German, but you get the idea!) In both cases the code can be:

do_substitution(text, verb, object);

Upvotes: 1

Related Questions