Bläddra i källkod

grass.py: Force encoding to be EUC-KR for the Korean language in Windows

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@70767 15284696-431f-4ddb-bdfa-cd5b030d7da7
Huidae Cho 8 år sedan
förälder
incheckning
8b2dc79c28
1 ändrade filer med 11 tillägg och 1 borttagningar
  1. 11 1
      lib/init/grass.py

+ 11 - 1
lib/init/grass.py

@@ -1171,15 +1171,25 @@ def set_language(grass_config_dir):
     # Set up environment for subprocesses
     os.environ['LANGUAGE'] = language
     os.environ['LANG'] = language
-    if encoding:
+
+    if language == 'ko_KR' and encoding == 'cp949':
+        # The default encoding for the Korean language in Windows is cp949,
+        # Microsoft's proprietary extension to euc-kr, but gettext prints no
+        # translated messages at all in the Command Prompt window if LC_CTYPE
+        # is set to ko_KR.cp949. Here, force LC_CTYPE to be euc-kr.
+        normalized = 'euc-kr'
+        encoding = None
+    elif encoding:
         normalized = locale.normalize('%s.%s' % (language, encoding))
     else:
         normalized = language
+
     for lc in ('LC_CTYPE', 'LC_MESSAGES', 'LC_TIME', 'LC_COLLATE',
                'LC_MONETARY', 'LC_PAPER', 'LC_NAME', 'LC_ADDRESS',
                'LC_TELEPHONE', 'LC_MEASUREMENT', 'LC_IDENTIFICATION'):
         os.environ[lc] = normalized
 
+
     # Some code in GRASS might not like other decimal separators than .
     # Other potential sources for problems are: LC_TIME LC_CTYPE
     locale.setlocale(locale.LC_NUMERIC, 'C')