i18n

Johannes Pfau nospam at example.com
Sun Feb 5 09:30:54 PST 2012


Am Sun, 5 Feb 2012 14:16:37 -0200
schrieb Jose Armando Garcia <jsancio at gmail.com>:

> On Sun, Feb 5, 2012 at 1:15 PM, xancorreu <xancorreu at gmail.com> wrote:
> > Al 05/02/12 05:26, En/na Jose Armando Garcia ha escrit:
> >>
> >> On Thu, Feb 2, 2012 at 4:48 PM, xancorreu<xancorreu at gmail.com>
> >>  wrote:
> >>>
> >>> Hi,
> >>>
> >>> Is there any way for localizate and internationalizate messages?
> >>> I were shocked if D has something like Fantom
> >>> [http://fantom.org/doc/docLang/Localization.html]. Gettext is
> >>> pretty ugly ;-)
> >>
> >> I just glanced at Fantom because I am very much interesting in
> >> localization framework design. You really think that Fantom's
> >> localization design is better than gettext? What human language is
> >> "$<fwt::cancel.name>"?
> >
> >
> > So, in conclusion, what can I do for localize outputs of programs?
> >
> >
> 
> I would suggest writing D binding for gettext and reading gettext
> documentation...
> 
> "Most GNU packages have the ability to output messages in several
> languages. This native-language support (NLS) requires the LibIntl and
> the LibIconv libraries. On MS-Windows they have been adapted so that
> NLS chooses the system language, unless the environment variables LANG
> and LANGUAGE have been set. The language codes (ISO 639) for these
> environment variables are different from the MS-Windows ones. When
> using a program in a console window (command.com or cmd.exe) and
> setting LANG and LANGUAGE, you must also set the correct code page
> with the chcp command; for Western European languages, code page 1252
> usually suffices. You can change the default code page by changing the
> OEMCP value in the registry key
> HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage
> 
> For other languages, such as those with a Cyrillic character set, NLS
> may not operate correctly, unless a TrueType font with these
> characters has been chosen. If you want to disable NLS, then set the
> environment variables LANGUAGE and LANG to en; then all messages will
> be in English. "
> 
> Hope that helps!
> -Jose

There's one problem with gettext though: It scans you source files for
strings to translate. This means you must at least use the gettext C
API exactly as in C and if you're lucky the C parser can extract the
strings from the D source. If not, you'll need a D parser.



More information about the Digitalmars-d-learn mailing list