[GRASS-SVN] r40540 - grass/branches/releasebranch_6_4/lib/init

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jan 18 18:39:38 EST 2010


Author: neteler
Date: 2010-01-18 18:39:37 -0500 (Mon, 18 Jan 2010)
New Revision: 40540

Added:
   grass/branches/releasebranch_6_4/lib/init/winlocale.c
Modified:
   grass/branches/releasebranch_6_4/lib/init/Makefile
   grass/branches/releasebranch_6_4/lib/init/init.bat
Log:
Set LANG on Windows (backport from trunk, r40533)

Modified: grass/branches/releasebranch_6_4/lib/init/Makefile
===================================================================
--- grass/branches/releasebranch_6_4/lib/init/Makefile	2010-01-18 23:39:37 UTC (rev 40539)
+++ grass/branches/releasebranch_6_4/lib/init/Makefile	2010-01-18 23:39:37 UTC (rev 40540)
@@ -61,6 +61,7 @@
 	FILES += \
 		$(ARCH_BINDIR)/$(START_UP).bat \
 		$(ETC)/Init.bat \
+		$(ETC)/winlocale$(EXE) \
 		$(ETC)/grass-run.bat
 endif
 
@@ -130,6 +131,9 @@
 	touch $@
 	chmod 600 $@
 
+$(ETC)/winlocale$(EXE): $(OBJDIR)/winlocale.o
+	$(CC) $(LDFLAGS) $(EXTRA_LDFLAGS) -o $@ $^ -lkernel32
+
 $(ETC)/VERSIONNUMBER:
 	rm -f $@
 	echo "$(GRASS_VERSION_NUMBER)" > $@

Modified: grass/branches/releasebranch_6_4/lib/init/init.bat
===================================================================
--- grass/branches/releasebranch_6_4/lib/init/init.bat	2010-01-18 23:39:37 UTC (rev 40539)
+++ grass/branches/releasebranch_6_4/lib/init/init.bat	2010-01-18 23:39:37 UTC (rev 40540)
@@ -38,6 +38,10 @@
 rem Generate GISBASE by converting dirsep characters from \ to /
 FOR /F "usebackq delims==" %%i IN (`g.dirseps -g "%WINGISBASE%"`) DO @set GISBASE=%%i
 
+if not "%LANG%"=="" goto langset
+FOR /F "usebackq delims==" %%i IN (`"%WINGISBASE%\etc\winlocale"`) DO @set LANG=%%i
+:langset
+
 set GRASS_PAGER=more
 if "%GRASS_WISH%"=="" set GRASS_WISH=wish.exe
 if "%GRASS_SH%"=="" set GRASS_SH=c:\msys\1.0\bin\sh.exe

Added: grass/branches/releasebranch_6_4/lib/init/winlocale.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/init/winlocale.c	                        (rev 0)
+++ grass/branches/releasebranch_6_4/lib/init/winlocale.c	2010-01-18 23:39:37 UTC (rev 40540)
@@ -0,0 +1,210 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <windows.h>
+
+static struct locale {
+    unsigned int code;
+    const char name[8];
+} locales[] = {
+    {0x0004, "zh_CHS"},	/* Chinese - Simplified */
+    {0x0401, "ar_SA"},	/* Arabic - Saudi Arabia */
+    {0x0402, "bg_BG"},	/* Bulgarian */
+    {0x0403, "ca_ES"},	/* Catalan */
+    {0x0404, "zh_TW"},	/* Chinese - Taiwan */
+    {0x0405, "cs_CZ"},	/* Czech */
+    {0x0406, "da_DK"},	/* Danish */
+    {0x0407, "de_DE"},	/* German - Germany */
+    {0x0408, "el_GR"},	/* Greek */
+    {0x0409, "en_US"},	/* English - United States */
+    {0x040a, "es_ES"},	/* Spanish - Spain */
+    {0x040b, "fi_FI"},	/* Finnish */
+    {0x040c, "fr_FR"},	/* French - France */
+    {0x040d, "he_IL"},	/* Hebrew */
+    {0x040e, "hu_HU"},	/* Hungarian */
+    {0x040f, "is_IS"},	/* Icelandic */
+    {0x0410, "it_IT"},	/* Italian - Italy */
+    {0x0411, "ja_JP"},	/* Japanese */
+    {0x0412, "ko_KR"},	/* Korean */
+    {0x0413, "nl_NL"},	/* Dutch - The Netherlands */
+    {0x0414, "nb_NO"},	/* Norwegian - Bokmal */
+    {0x0415, "pl_PL"},	/* Polish */
+    {0x0416, "pt_BR"},	/* Portuguese - Brazil */
+    {0x0417, "rm_CH"},	/* Raeto-Romanese */
+    {0x0418, "ro_RO"},	/* Romanian - Romania */
+    {0x0419, "ru_RU"},	/* Russian */
+    {0x041a, "hr_HR"},	/* Croatian */
+    {0x041b, "sk_SK"},	/* Slovak */
+    {0x041c, "sq_AL"},	/* Albanian */
+    {0x041d, "sv_SE"},	/* Swedish - Sweden */
+    {0x041e, "th_TH"},	/* Thai */
+    {0x041f, "tr_TR"},	/* Turkish */
+    {0x0420, "ur_PK"},	/* Urdu */
+    {0x0421, "id_ID"},	/* Indonesian */
+    {0x0422, "uk_UA"},	/* Ukrainian */
+    {0x0423, "be_BY"},	/* Belarusian */
+    {0x0424, "sl_SI"},	/* Slovenian */
+    {0x0425, "et_EE"},	/* Estonian */
+    {0x0426, "lv_LV"},	/* Latvian */
+    {0x0427, "lt_LT"},	/* Lithuanian */
+    {0x0429, "fa_IR"},	/* Persian */
+    {0x042a, "vi_VN"},	/* Vietnamese */
+    {0x042b, "hy_AM"},	/* Armenian */
+    {0x042c, "az_AZ"},	/* Azeri Latin */
+    {0x042d, "eu_ES"},	/* Basque */
+    {0x042f, "mk_MK"},	/* FYRO Macedonian */
+    {0x0432, "tn_ZA"},	/* Setswana - Southern Africa */
+    {0x0434, "xh_ZA"},	/* Xhosa - South Africa */
+    {0x0435, "zu_ZA"},	/* Zulu */
+    {0x0436, "af_ZA"},	/* Afrikaans */
+    {0x0437, "ka_GE"},	/* Georgian */
+    {0x0438, "fo_FO"},	/* Faroese */
+    {0x0439, "hi_IN"},	/* Hindi */
+    {0x043a, "mt_MT"},	/* Maltese */
+    {0x043b, "se_NO"},	/* Sami Northern Norway */
+    {0x043e, "ms_MY"},	/* Malay - Malaysia */
+    {0x043f, "kk_KZ"},	/* Kazakh */
+    {0x0440, "ky_KG"},	/* Kyrgyz */
+    {0x0441, "sw_KE"},	/* Swahili */
+    {0x0443, "uz_UZ"},	/* Uzbek - Latin */
+    {0x0444, "tt_RU"},	/* Tatar */
+    {0x0445, "bn_IN"},	/* Begali */
+    {0x0446, "pa_IN"},	/* Punjabi */
+    {0x0447, "gu_IN"},	/* Gujarati */
+    {0x0448, "or_IN"},	/* Oriya - India */
+    {0x0449, "ta_IN"},	/* Tamil */
+    {0x044a, "te_IN"},	/* Telugu */
+    {0x044b, "kn_IN"},	/* Kannada - India */
+    {0x044c, "ml_IN"},	/* Malayalam - India */
+    {0x044e, "mr_IN"},	/* Marathi */
+    {0x044f, "sa_IN"},	/* Sanskrit */
+    {0x0450, "mn_MN"},	/* Mongolian */
+    {0x0452, "cy_GB"},	/* Welsh */
+    {0x0456, "gl_ES"},	/* Galician */
+    {0x0457, "kok_IN"},	/* Konkani */
+    {0x045a, "syr_SY"},	/* Syriac */
+    {0x045d, "iu_CA"},	/* Inuktitut */
+    {0x0461, "ne_NP"},	/* Nepali */
+    {0x0462, "fy_NL"},	/* Frisian - Netherlands */
+    {0x0463, "ps_AF"},	/* Pashto - Afghanistan */
+    {0x0464, "fil_PH"},	/* Filipino */
+    {0x0465, "div_MV"},	/* Divehi - Maldives */
+    {0x046b, "quz_BO"},	/* Quechua (Bolivia) */
+    {0x046c, "ns_ZA"},	/* Northern Sotho */
+    {0x046e, "lb_LU"},	/* Luxembourgish */
+    {0x047a, "arn_CL"},	/* Mapudungun */
+    {0x047c, "moh_CA"},	/* Mohawk - Canada */
+    {0x047e, "br_FR"},	/* Breton - France */
+    {0x0481, "mi_NZ"},	/* Maori */
+    {0x0482, "oc_FR"},	/* Occitan - France */
+    {0x048c, "gbz_AF"},	/* Dari - Afghanistan */
+    {0x0801, "ar_IQ"},	/* Arabic - Iraq */
+    {0x0804, "zh_CN"},	/* Chinese - PRC */
+    {0x0807, "de_CH"},	/* German - Switzerland */
+    {0x0809, "en_GB"},	/* English - United Kingdom */
+    {0x080a, "es_MX"},	/* Spanish - Mexico */
+    {0x080c, "fr_BE"},	/* French - Belgium */
+    {0x0810, "it_CH"},	/* Italian - Switzerland */
+    {0x0813, "nl_BE"},	/* Dutch - Belgium */
+    {0x0814, "nn_NO"},	/* Norwegian - Nynorsk */
+    {0x0816, "pt_PT"},	/* Portuguese - Portugal */
+    {0x081a, "sr_SP"},	/* Serbian - Latin */
+    {0x081d, "sv_FI"},	/* Swedish - Finland */
+    {0x0820, "ur_IN"},	/* Urdu - India */
+    {0x082c, "az_AZ"},	/* Azeri - Cyrillic */
+    {0x083b, "se_SE"},	/* Sami Northern Sweden */
+    {0x083c, "ga_IE"},	/* Irish - Ireland */
+    {0x083e, "ms_BN"},	/* Malay - Brunei */
+    {0x0843, "uz_UZ"},	/* Uzbek - Cyrillic */
+    {0x085d, "iu_CA"},	/* Inuktitut - Latin */
+    {0x086b, "quz_EC"},	/* Quechua (Ecuador) */
+    {0x0c01, "ar_EG"},	/* Arabic - Egypt */
+    {0x0c04, "zh_HK"},	/* Chinese - Hong Kong S.A.R. */
+    {0x0c07, "de_AT"},	/* German - Austria */
+    {0x0c09, "en_AU"},	/* English - Australia */
+    {0x0c0a, "es_ES"},	/* Spanish - Spain (Modern) */
+    {0x0c0c, "fr_CA"},	/* French - Canada */
+    {0x0c1a, "sr_SP"},	/* Serbian - Cyrillic */
+    {0x0c3b, "se_FI"},	/* Sami Northern Finland */
+    {0x0c6b, "quz_PE"},	/* Quechua (Peru) */
+    {0x1001, "ar_LY"},	/* Arabic - Libya */
+    {0x1004, "zh_SG"},	/* Chinese - Singapore */
+    {0x1007, "de_LU"},	/* German - Luxembourg */
+    {0x1009, "en_CA"},	/* English - Canada */
+    {0x100a, "es_GT"},	/* Spanish - Guatemala */
+    {0x100c, "fr_CH"},	/* French - Switzerland */
+    {0x101a, "hr_BA"},	/* Croatian - Bosnia */
+    {0x103b, "smj_NO"},	/* Sami Norway */
+    {0x1401, "ar_DZ"},	/* Arabic - Algeria */
+    {0x1404, "zh_MO"},	/* Chinese - Macao S.A.R. */
+    {0x1407, "de_LI"},	/* German - Liechtenstein */
+    {0x1409, "en_NZ"},	/* English - New Zealand */
+    {0x140a, "es_CR"},	/* Spanish - Costa Rica */
+    {0x140c, "fr_LU"},	/* French - Luxembourg */
+    {0x141a, "bs_BA"},	/* Bosnian - Cyrillic */
+    {0x143b, "smj_SE"},	/* Sami Sweden */
+    {0x1801, "ar_MA"},	/* Arabic - Morocco */
+    {0x1809, "en_IE"},	/* English - Ireland */
+    {0x180a, "es_PA"},	/* Spanish - Panama */
+    {0x180c, "fr_MC"},	/* French - Monaco */
+    {0x181a, "sr_BA"},	/* Serbian - Bosnia Latin */
+    {0x183b, "sma_NO"},	/* Sami Southern Norway */
+    {0x1c01, "ar_TN"},	/* Arabic - Tunisia */
+    {0x1c09, "en_ZA"},	/* English - South Africa */
+    {0x1c0a, "es_DO"},	/* Spanish - Dominican Republic */
+    {0x1c1a, "sr_BA"},	/* Serbian - Bosnia Cyrillic */
+    {0x1c3b, "sma_SE"},	/* Sami Southern Sweden */
+    {0x2001, "ar_OM"},	/* Arabic - Oman */
+    {0x2009, "en_JA"},	/* English - Jamaica */
+    {0x200a, "es_VE"},	/* Spanish - Venezuela */
+    {0x201a, "bs_BA"},	/* Bosnian */
+    {0x203b, "sms_FI"},	/* Sami Skolt */
+    {0x2401, "ar_YE"},	/* Arabic - Yemen */
+    {0x2409, "en_CB"},	/* English - Carribbean */
+    {0x240a, "es_CO"},	/* Spanish - Colombia */
+    {0x243b, "smn_FI"},	/* Sami Finland */
+    {0x2801, "ar_SY"},	/* Arabic - Syria */
+    {0x2809, "en_BZ"},	/* English - Belize */
+    {0x280a, "es_PE"},	/* Spanish - Peru */
+    {0x2c01, "ar_JO"},	/* Arabic - Jordan */
+    {0x2c09, "en_TT"},	/* English - Trinidad */
+    {0x2c0a, "es_AR"},	/* Spanish - Argentina */
+    {0x3001, "ar_LB"},	/* Arabic - Lebanon */
+    {0x3009, "en_ZW"},	/* English - Zimbabwe */
+    {0x300a, "es_EC"},	/* Spanish - Ecuador */
+    {0x3401, "ar_KW"},	/* Arabic - Kuwait */
+    {0x3409, "en_PH"},	/* English - Phillippines */
+    {0x340a, "es_CL"},	/* Spanish - Chile */
+    {0x3801, "ar_AE"},	/* Arabic - United Arab Emirates */
+    {0x380a, "es_UR"},	/* Spanish - Uruguay */
+    {0x3c01, "ar_BH"},	/* Arabic - Bahrain */
+    {0x3c0a, "es_PY"},	/* Spanish - Paraguay */
+    {0x4001, "ar_QA"},	/* Arabic - Qatar */
+    {0x400a, "es_BO"},	/* Spanish - Bolivia */
+    {0x440a, "es_SV"},	/* Spanish - El Salvador */
+    {0x480a, "es_HN"},	/* Spanish - Honduras */
+    {0x4c0a, "es_NI"},	/* Spanish - Nicaragua */
+    {0x500a, "es_PR"},	/* Spanish - Puerto Rico */
+    {0x7c04, "zh_CHT"},	/* Chinese - Traditional */
+};
+
+static int num_locales = sizeof(locales) / sizeof(locales[0]);
+
+static int compare(const void *pkey, const void *pval)
+{
+    LCID code = *(const LCID *)pkey;
+    const struct locale *loc = pval;
+    return code - loc->code;
+}
+
+int main(void)
+{
+    LCID code = GetUserDefaultLCID();
+    struct locale *loc = bsearch(&code,
+				 locales, num_locales, sizeof(locales[0]),
+				 compare);
+    if (!loc)
+	return 1;
+    fprintf(stdout, "%s\n", loc->name);
+    return 0;
+}


Property changes on: grass/branches/releasebranch_6_4/lib/init/winlocale.c
___________________________________________________________________
Added: svn:eol-style
   + native



More information about the grass-commit mailing list