For serious i18n work I'd use ICU. I believe Mango even has a wrapper for some of it.
Sent from my iPhone On Aug 14, 2011, at 8:50 AM, Johannes Pfau <[email protected]> wrote: > Jacob Carlborg wrote: >> On 2011-08-12 23:02, bioinfornatics wrote: >>> Dear, >>> I would like to know how do a multilanguage application. It seem it >>> is possible by using flag -J but they are no document for this >>> feature. link givent in this page >>> http://www.digitalmars.com/d/2.0/dmd-linux.html seem to be wrong >>> >>> if you can do a little example, will be nice >>> >>> thanks >>> >>> kind regards >> >> It's fairly simple. You just need a file containing keys and values. >> This file can be read either at compile time or runtime. Read the file >> into an associative array and when you need a piece of text translated >> just pass the key to a function which retries the corresponding value >> from the associative array. > > I think the std.string functions tr, translate, maketrans are meant to > do that. > But there's a lot more to proper i18n and even for translation a simple > key/value table isn't perfect. > gettext for example also handles plural forms and context information. > (A translation might be different depending on it's context.) > > Implementing all this stuff can get quite difficult, just have a look > at the plural formulas for different languages: > http://translate.sourceforge.net/wiki/l10n/pluralforms > >> >> You could take a look at how internalization is don in Ruby on Rails, >> this can be applied to D as well: >> http://guides.rubyonrails.org/i18n.html >> > > > -- > Johannes Pfau >
