Wang Dingwei avatar Wang Dingwei committed 74ff2a4

Fixed MUI logic, again

Comments (0)

Files changed (2)

 "Constants for other modules."
 
-VERSION = 4.2
+VERSION = 5.0
 SDR_PATH = 'C:\\dell.sdr'
 
     """Return True if sdr_lang matches os_lang.
     sdr_lang -> ('LANG_STR', ['REGION_1', 'REGION2'])
     os_lang  -> ('LANG_STR', 'REGION')"""
-    if sdr_lang[0] == os_lang[0]:
-        if not sdr_lang[1] or os_lang[1] in sdr_lang[1]:
+    if sdr_lang[0] == os_lang[0]:               # Same language
+        if not sdr_lang[1] or not os_lang[1]:   # region undefined
+            return True
+        elif sdr_lang[1] in os_lang[1]:         # same region
             return True
         else:
             return False
         for s in sdr_mui:
             if lang_matched(s, o):
                 match_count += 1
-                break
+                continue
     return match_count == len(sdr_mui)
 
 
         return 'Windows ' + os_ + ' ' + sub_ + sp_ + arch_
 
     def get_os_langs_str(self):
+        "Returns a list of MUI languages used by the OS."
         lang_strs = []
         for lang in self.os_langs:
             try:
         return lang_strs
 
     def get_os_lang_str(self):
+        "Returns language description of the OS."
         if self.os_lang[1]:
             region = '(' + self.os_lang[1] + ')'
         else:
         return self.os_lang[0] + region
 
     def get_sdr_lang_str(self):
+        "Returns a list of MUI languages defined in the SDR."
         if self.sdrobj.is_mui():
             return ''
 
         return self.sdr_lang[0] + region
 
     def get_sdr_langs_str(self):
+        "Returns language description of the SDR."
         lang_strs = []
         for lang in self.sdr_langs:
             if lang[1]:
         return lang_strs
 
     def get_os_info(self):
+        "Read OS information from registry."
         try:
             self.os_type = ostype.GetWindowsVersion()
             self.os_lang = ostype.GetWindowsLanguage()
             raise
 
     def get_sdr_info(self):
+        "Read SDR information from SDR_PATH"
         try:
             self.sdrobj = sdrparser.SDR(SDR_PATH)
         except Exception, e:
             raise
 
     def compare(self):
+        "Compare between OS and SDR and updates the result."
         if self.sdrobj.is_mui():
             self.msg.append("This is MUI order.")
             self.sdr_langs = self.sdrobj.mui_langs()
-            self.result = 'OK' if self.os_langs == self.sdr_langs else 'NG'
+            self.result = ('OK'
+                           if mui_matched(self.os_langs, self.sdr_langs)
+                           else 'NG')
         else:
             if (self.os_type == self.sdr_type and 
                 lang_matched(self.sdr_lang, self.os_lang)):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.