Blob Blame History Raw
--- yum-langpacks-0.4.2.old/langpacks.py	2014-11-20 23:09:11.495254242 +0530
+++ yum-langpacks-0.4.2/langpacks.py	2014-11-20 18:03:55.000000000 +0530
@@ -311,18 +311,22 @@
             if lname:
                 if pkgs.find(lname, len(pkgs)-len(lname), len(pkgs)) > 0 :
                     avl_langpack_pkgs.append(pkgs)
-        if len(lang) > 4 and lang.find("_") != -1:
-            mainlang = lang[0:lang.find("_")]
-            if pkgs.find(lang, len(pkgs)-len(lang), len(pkgs)) > 0 :
-                avl_langpack_pkgs.append(pkgs)
-           # if input pt_BR then show for pt and pt_BR
-            # if input zh_CN then show for zh and zh_CN
-            elif pkgs.find(mainlang, len(pkgs)-len(mainlang), len(pkgs)) > 0 :
-                avl_langpack_pkgs.append(pkgs)
 
-            if lname:
-                if pkgs.find(lname, len(pkgs)-len(lname), len(pkgs)) > 0 :
-                    avl_langpack_pkgs.append(pkgs)
+        if len(lang) > 4:
+            if lang.find("_") != -1:
+               mainlang = lang[0:lang.find("_")]
+               if lang.find("_CN") != -1 and pkgs.find("-CN") != -1:
+                   avl_langpack_pkgs.append(pkgs)
+               if pkgs.find(lang, len(pkgs)-len(lang), len(pkgs)) > 0:
+                   avl_langpack_pkgs.append(pkgs)
+               # if input pt_BR then show for pt and pt_BR
+               # if input zh_CN then show for zh and zh_CN
+               elif pkgs.find(mainlang, len(pkgs)-len(mainlang), len(pkgs)) > 0:
+                     avl_langpack_pkgs.append(pkgs)
+
+               if lname:
+                   if pkgs.find(lname, len(pkgs)-len(lname), len(pkgs)) > 0:
+                       avl_langpack_pkgs.append(pkgs)
 
     return sorted(avl_langpack_pkgs)
 
@@ -414,6 +418,11 @@
                 if p not in pkgmatches:
                     pkgmatches.append(p)
 
+    # This is special case to cover package name man-pages-zh-CN
+    # which should have been named as man-pages-zh_CN
+    if lang.find("zh_CN") != -1:
+       pkgmatches.append("man-pages-zh-CN")
+
     pkgs = get_matches(sack, pkgmatches)
     for pkg in pkgs:
         if yb.rpmdb.searchNevra(name=pkg.name):
@@ -446,6 +455,11 @@
             if p not in pkgmatches:
                 pkgmatches.append(p)
 
+    # This is special case to cover package name man-pages-zh-CN
+    # which should have been named as man-pages-zh_CN
+    if lang.find("zh_CN") != -1:
+       pkgmatches.append("man-pages-zh-CN")
+
     pkgs = get_matches(yb.rpmdb, pkgmatches)
     for pkg in pkgs:
         if conduit and hasattr(conduit, 'registerPackageName'):