i18n

DNewbie run3 at myopera.com
Fri Feb 3 13:47:43 PST 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;
}
---------------------------------------------------------




More information about the Digitalmars-d-learn mailing list