how to detect computer's language ?

Back when I was using VB6 I used a trick to see what was the computer Language,
with “weekdayname” (the exact keyword might have been different, it was sometime ago) anyhow…if the resulting string was “monday” I knew the pc was “speaking” English…if the resulting string was “Lunes” then it was Spanish.

Is this possible also with Xojo with a similar method ?

tks

Really depends on what the goal is

Most often its “what language is the app running in” that’s desired.

If you write an application and support a few different languages then using dynamic constants can make it so you literally don’t have to do anything.
You create the dynamic constant, and add in a localized version for each language you support & at runtime your application will use the correct one based on the users settings AND what your app supports.
Using this same technique you can create ONE dynamic constant that is just a list of values - one per language
The English value is “English”
The French one you put “French”
And so on
The same thing holds true for this - based on the users language setting & what your application support reading the value will tell yo what language your application is operating in
See http://www.xojo.com/blog/en/2013/12/how-os-x-chooses-a-language.php
and http://www.xojo.com/blog/en/2014/03/picking-a-language-at-runtime.php

If all you want is the actual language id the computer is running in (which could be different from the language your application is running in especially on OS X) then you can ask the system for it - on OS X there is MacOSLib you can get the language from that.
On Windows I think WFS has a way to tell you.

[quote=142179:@Horacio Vilches]Back when I was using VB6 I used a trick to see what was the computer Language,
with “weekdayname” (the exact keyword might have been different, it was sometime ago) anyhow…if the resulting string was “monday” I knew the pc was “speaking” English…if the resulting string was “Lunes” then it was Spanish.
[/quote]

The equivalent is http://documentation.xojo.com/index.php/Date.DayOfWeek

But the user may decide to change the settings to have dates in Spanish, while the computer is in English, for instance. So your method only reports the user preference for date format.

the first question should be: Desktop, Web? If desktop, Mac, Windows, Linux?

OSX

  dim myShell as New Shell
  myShell.Execute "defaults read -g AppleLocale"
  MsgBox myShell.Result

better NSLocaleMBS.preferredLanguages to get the language list.

The OP has already marked this as “answered” :stuck_out_tongue: