Localization: default measurement units



Hi,

Is it possible to determine the default measurement unit (metric or
imperial) for the current locale?
The command:

locale -ck LC_MEASUREMENT

gives me the following output:

LC_MEASUREMENT
measurement=2
measurement-codeset="UTF-8"

I'm not sure what '2' is, but I would be happy if I could at least get
the same result with the code below:

#include <stdio.h>
#include <locale.h>
#include <langinfo.h>

int main() {
#ifdef LC_MEASUREMENT
setlocale(LC_ALL, "");
printf("%s\n", nl_langinfo(_NL_NUM_LC_MEASUREMENT));
#endif
return 0;
}

However, it prints nothing but an empty line.

Any idea how this could be done?

Cosmin
.



Relevant Pages

  • Re: Gawk match() and numbers in scientific notation
    ... values and don't take locale into account. ... # prints the entire current collating sequence, ... Of course, I don't know whether such a command exists, or even whether it's ... nonstandard features. ...
    (comp.lang.awk)
  • Re: [opensuse] OpenSUSE 10.3 benchmarking: slower than 10.2?
    ... I can set LANG to en_US.UTF-8, but I would like to have the ... test report include the language setting to confirm that it is set right. ... The command ... should tell me whether the locale is installed, but doesn't, because it ...
    (SuSE)
  • Re: 24 hour clock in Evolution
    ... If you did it while Evolution was open then the command will ... Use the locale command to confirm change after logout/login ... default locale only in the absence of an am/pm format ...
    (Ubuntu)
  • Re: Read data with decimal point "," instead of the english "."
    ... The first form interprets the locale settings in your current ... The second form forces a specific locale, ... The "set locale" command by itself does not affect input, ... set decimalsign '.' ...
    (comp.graphics.apps.gnuplot)
  • Re: where can i report this bug?
    ... can see the info and potentially help. ... HOW do i set/reset the locale settings on the boxes? ... rather than a command line instruction. ... i386 Binary-1 ]/ etch main ...
    (Debian-User)