i18n

Topics: Language Specification
Jan 29, 2013 at 9:27 AM
Edited Jan 29, 2013 at 9:31 AM

Hello,

it could be interesting to have native support in typescript for i18n... The syntax could be simple, eg :

#("en"); //or #("fr")  for setting the language

var str :string = #mywordtotranslate ; // for getting the right translation

The translations files should follow a rule like for instance this one ;

1) files into a "i18n" directory

2) each file following the naming convention i18n.en, i18n.fr, and so on...

3) the content being as follow :

myword1=blbla
myword2=blblaaa

best regards

 

Xavier

Mar 15, 2013 at 7:40 PM
Hello Xavier,

how do you want TypeScript to traverse a directory or read a file?
TypeScript only compiles to standard EcmaScript 5 thus you do not have any file-related functions because ES5 should be used in various environments, e.g. in the browser, using Node.js, as a Windows 8 app, etc.

The only solution would be to provide libraries for the different environments but this is not something TypeScript should handle in my opinion.

Best Regards
ComFreek
Mar 15, 2013 at 7:55 PM
Hi comfreeq
As typescript is a kind of macrosubstitutor, it would be a shortcut to the use of a library as "import" with amd is a shortcut to "require". Not more.

Best regards
Xavier

Envoyé de mon iPhone

Le 15 mars 2013 à 20:42, "ComFreek" <notifications@codeplex.com> a écrit :

From: ComFreek

Hello Xavier,

how do you want TypeScript to traverse a directory or read a file?
TypeScript only compiles to standard EcmaScript 5 thus you do not have any file-related functions because ES5 should be used in various environments, e.g. in the browser, using Node.js, as a Windows 8 app, etc.

The only solution would be to provide libraries for the different environments but this is not something TypeScript should handle in my opinion.

Best Regards
ComFreek