Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2016-08-17 11:58:04 +0300
committerCorinna Vinschen <corinna@vinschen.de>2016-08-17 11:58:04 +0300
commitc02ac89f28047526c541e6653fad559c171cc2b7 (patch)
tree3c1c1a41ec5f4af5c0f479e75ee899360c8c00bf /winsup/utils/locale.cc
parentb0d341442c7cd63f3e1c49c76cb40e870c4d5b19 (diff)
Add -i/--input option to locale(1)
The default UI language returned by GetUserDefaultUILanguage does not necessarily reflect what the user really wants. E. g., the system could be en_US, but the desired language is en_CA, without having a CA langpack installed. Changing the settings under "Languages" and changing the keyboard layout is only affecting the so-called "Input language", while what's returned by GetUserDefaultUILanguage is the "Display language". Changing the latter requires installing MUI langpacks. Thus, we introduce a way to fetch the "Input language" using the -i or --input option. Also clean up documentation of locale(1). Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup/utils/locale.cc')
-rw-r--r--winsup/utils/locale.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/winsup/utils/locale.cc b/winsup/utils/locale.cc
index c9d4b5d59..1cd04337c 100644
--- a/winsup/utils/locale.cc
+++ b/winsup/utils/locale.cc
@@ -48,7 +48,7 @@ usage ()
printf (
"Usage: %1$s [-amvhV]\n"
" or: %1$s [-ck] NAME\n"
-" or: %1$s [-usfnU]\n"
+" or: %1$s [-iusfnU]\n"
"\n"
"Get locale-specific information.\n"
"\n"
@@ -65,6 +65,7 @@ usage ()
"\n"
"Default locale information:\n"
"\n"
+" -i, --input Print current input locale\n"
" -u, --user Print locale of user's default UI language\n"
" -s, --system Print locale of system default UI language\n"
" -f, --format Print locale of user's regional format settings\n"
@@ -93,6 +94,7 @@ struct option longopts[] = {
{"category-name", no_argument, NULL, 'c'},
{"format", no_argument, NULL, 'f'},
{"help", no_argument, NULL, 'h'},
+ {"input", no_argument, NULL, 'i'},
{"keyword-name", no_argument, NULL, 'k'},
{"charmaps", no_argument, NULL, 'm'},
{"no-unicode", no_argument, NULL, 'n'},
@@ -103,7 +105,7 @@ struct option longopts[] = {
{"version", no_argument, NULL, 'V'},
{0, no_argument, NULL, 0}
};
-const char *opts = "acfhkmnsuUvV";
+const char *opts = "acfhikmnsuUvV";
int
getlocale (LCID lcid, char *name)
@@ -786,6 +788,9 @@ main (int argc, char **argv)
case 'm':
maps = 1;
break;
+ case 'i':
+ lcid = (UINT_PTR) GetKeyboardLayout (0) & 0xffff;
+ break;
case 's':
lcid = GetSystemDefaultUILanguage ();
break;