]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Fix Portugeuse localization fallback (<rdar://problem/21873202>)
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Mon, 20 Jul 2015 17:05:06 +0000 (17:05 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Mon, 20 Jul 2015 17:05:06 +0000 (17:05 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@12790 a1ca3aef-8c08-0410-bb20-df032aa958be

cups/language.c

index dcc1449305deef45710c2fd0c3b0544dd1cd9b36..aea85657a26113bf1d63e40871171b8d38eb7ac5 100644 (file)
@@ -3,7 +3,7 @@
  *
  * I18N/language support for CUPS.
  *
- * Copyright 2007-2014 by Apple Inc.
+ * Copyright 2007-2015 by Apple Inc.
  * Copyright 1997-2007 by Easy Software Products.
  *
  * These coded instructions, statements, and computer programs are the
@@ -1305,7 +1305,8 @@ static cups_array_t *                     /* O - Message catalog */
 appleMessageLoad(const char *locale)   /* I - Locale ID */
 {
   char                 filename[1024], /* Path to cups.strings file */
-                       applelang[256]; /* Apple language ID */
+                       applelang[256], /* Apple language ID */
+                       baselang[3];    /* Base language */
   CFURLRef             url;            /* URL to cups.strings file */
   CFReadStreamRef      stream = NULL;  /* File stream */
   CFPropertyListRef    plist = NULL;   /* Localization file */
@@ -1345,6 +1346,15 @@ appleMessageLoad(const char *locale)     /* I - Locale ID */
       locale = "Japanese";
     else if (!strncmp(locale, "es", 2))
       locale = "Spanish";
+    else if (strstr(locale, "_") != NULL || strstr(locale, "-") != NULL)
+    {
+     /*
+      * Drop country code, just try language...
+      */
+
+      strlcpy(baselang, locale, sizeof(baselang));
+      locale = baselang;
+    }
 
     snprintf(filename, sizeof(filename),
             CUPS_BUNDLEDIR "/Resources/%s.lproj/cups.strings", locale);