Thread overview
Re: i18n
Feb 03, 2012
xancorreu
Feb 03, 2012
Trass3r
Feb 03, 2012
DNewbie
February 03, 2012
Al 03/02/12 19:48, En/na DNewbie ha escrit:
> You can build multiple versions of you app:
> http://dsource.org/projects/tutorials/wiki/LocalesExample
>
>
> On Thu, Feb 2, 2012, at 07:48 PM, xancorreu 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 ;-)
>>
>>
>> If not, any plannings?
>>
>> Thanks,
>> Xan.
>>
>
Thanks a lot, So I just need to "detect" user locale using.... How to do that?

Xan.
February 03, 2012
> Thanks a lot, So I just need to "detect" user locale using.... How to do that?

You can always use the functions you would use in C.
February 03, 2012

On Fri, Feb 3, 2012, at 09:48 PM, Trass3r wrote:
> > Thanks a lot, So I just need to "detect" user locale using.... How to do that?
> 
> You can always use the functions you would use in C.
> 


You can see your language id in this page: http://msdn.microsoft.com/en-us/library/dd318693(v=vs.85).aspx

Example
---------------------------------------------------------
import std.stdio;
import std.c.windows.windows;
alias DWORD LCID;
extern (Windows) LCID GetSystemDefaultLCID();

int main()
{
  LCID lcid = GetSystemDefaultLCID();
  printf("GetSystemDefaultLCID = 0x%04X\n", lcid);

  switch (lcid)
  {
    case 0x0409:
      writeln("United States (US)");
    break;

    case 0x040c:
      writeln("France (FR)");
    break;

    default:
      writeln("Unknown");
    break;

  }
  return 0;
}
---------------------------------------------------------