Find out OS language via datestr command?

Hi folks,
i wonder if the datestr command can help finding out the operating system's basic language.
I can only test the German and English version at my system via:
datestr('05/01/2000','mmmm','local')
If the result is "may", it is English. If it is "mai", it is German.
I wonder if this also works in Spanish and Swedish home countries e.g.. Who can help me find out? What local settings are respected inside the datestr command?
To be more precise: I want information about the language, which is used to display the Windows 7 startmenu-ribbon with "documents", "images", "music", "computer", "system", ... or (German): "Dokumente", "Bilder", "Musik", ...
Regards, Johannes

2 Kommentare

Andreas Goser
Andreas Goser am 5 Jun. 2013
I am interested about the background of this request. In particular if this is related to Volkswagen locations in countries in Asia, there may be value to get in touch with MathWorks.
Johannes Korsawe
Johannes Korsawe am 5 Jun. 2013
Background is distribution of MATLAB compiled applications to Sweden and Brasil. No Chinese users of my tools by now.

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Jan
Jan am 4 Jun. 2013
Bearbeitet: Jan am 5 Jun. 2013

2 Stimmen

What about:
get(0, 'Language')
I assume this is the way datestr() gets the information also.
[EDITED] What about the Java method:
System.getProperty("user.language")
Or perhaps (I cannot test it currently):
locale = java.util.Locale.getDefault();
language = locale.getLanguage()

3 Kommentare

Johannes Korsawe
Johannes Korsawe am 5 Jun. 2013
Bearbeitet: Johannes Korsawe am 5 Jun. 2013
Thank you Jan. A fast way at least.
But is that really the os-language or does this command return the language which has been chosen for the MATLAB-installation?
The question is: on a - lets say - Spanish "Windows 7"-System with an English MATLAB installed. What value would be returned by get(0,'Language') ?
The same question may arise about my suggestion with the use of "datestr", although the option "locale" hints more in direction of system settings than MATLAB installation language.
@Johannes: You can be sure that I do not dare to answer this question. Confusions about multi-language setups build the core of the computer history. I've seen too many dialogs like:
The Windows-Explorer observed a problem.
[Ja] [Nein] [Cancel]
You have to ask the OS directly for a more reliable information about the currently active language. But remember that the user can change different formats for the date and the text of dialogs. So what exactly is "the systems basic language"?
Johannes Korsawe
Johannes Korsawe am 5 Jun. 2013
Bearbeitet: Johannes Korsawe am 5 Jun. 2013
@Jan: I was not aware of this, but now i see that language is a manifold topic in OS context.
I now edited the original question to more precisely define what i want to have. Not knowing, whether there is a way to find out, but now it maybe not a MATLAB topic any longer.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (2)

Friedrich
Friedrich am 5 Jun. 2013

1 Stimme

HI,
what about:
>> java.lang.System.getProperty('user.language')
ans =
de
>> java.lang.System.getProperty('user.country')
ans =
DE
Not sure which one is needed exactly here. Could someone with an non German OS try that?

2 Kommentare

Johannes Korsawe
Johannes Korsawe am 5 Jun. 2013
Thank you for this suggestion. (Jan had been a bit earlier, see above.)
The basic question maybe now rather a Windows-specific question and no longer a MATLAB question.
Friedrich
Friedrich am 5 Jun. 2013
Bearbeitet: Friedrich am 5 Jun. 2013
Sorry havent seen that.
But overall that wont work because it depends on the System's Regional Settings. Just the location setting of your system wont help. When your regional setting is DE but your language is set to english you will get DE as answer from JAVA but you actually have an english language OS.
See also here:
The ONLY reliable thing on WIndows is:
>>System.Globalization.CultureInfo.CurrentUICulture.ThreeLetterWindowsLanguageName

Melden Sie sich an, um zu kommentieren.

Daniel Shub
Daniel Shub am 4 Jun. 2013
Bearbeitet: Daniel Shub am 4 Jun. 2013

0 Stimmen

You probably can, but it seems really silly to try. On Linux you can do
! echo $LANG
For Windows, I don't know an easy one line answer, but you could parse
! wmic os get locale
or
! wmic os get oslanguage

5 Kommentare

Johannes Korsawe
Johannes Korsawe am 4 Jun. 2013
Nice idea, did not know that.
But it takes factor >600 times longer to just query the systeminfo plus postprocessing/parsing the result.
Could this be done faster?
Daniel Shub
Daniel Shub am 4 Jun. 2013
I edited the answer to use wmic instead of systeminfo.
In MATLAB,
getenv('LANG')
I do not know if that works in MS Windows
Daniel Shub
Daniel Shub am 4 Jun. 2013
@Walter I believe it would work if MS Windows set a LANG variable, but in general it doesn't ...
Johannes Korsawe
Johannes Korsawe am 5 Jun. 2013
Thank you Daniel for this ~15times faster command than systeminfo. I am learning and learning :-) This might be the correct direction.
Unfortunately the return values send different signals to me:
!wmic os get locale returns Locale 0407, which is de_de.
!wmic os get oslanguage returns OSLanguage 1033, which is en_us.
Now, curiously, when i start, e.g. the "Start"-menu-Button on the lower left of my Windows 7 system, all the descriptions are German. I would have expected the OSLanguage to return the German value 1031.
So i edited my question above to become more precise in the definition of "os language".

Melden Sie sich an, um zu kommentieren.

Kategorien

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by