[Pkg-cups-devel] r586 - in cupsys/trunk: . debian debian/patches

Martin Pitt mpitt at alioth.debian.org
Tue Sep 11 20:52:37 UTC 2007


Author: mpitt
Date: Tue Sep 11 20:52:37 2007
New Revision: 586

Log:
* Add debian/patches/str2505_localize.dpatch: Fix localization of web
  interface (STR#2505, Closes: #440256)

Added:
   cupsys/trunk/debian/patches/str2505_localize.dpatch   (contents, props changed)
Modified:
   cupsys/trunk/   (props changed)
   cupsys/trunk/debian/changelog
   cupsys/trunk/debian/patches/00list

Modified: cupsys/trunk/debian/changelog
==============================================================================
--- cupsys/trunk/debian/changelog	(original)
+++ cupsys/trunk/debian/changelog	Tue Sep 11 20:52:37 2007
@@ -11,8 +11,10 @@
   * Add debian/patches/str2508-dont_kill_edit-config.tmpl.dpatch: Do not kill
     edit-config.tmpl on distclean. Forwarded upstream as STR#2508.
     (Closes: #441697)
+  * Add debian/patches/str2505_localize.dpatch: Fix localization of web
+    interface (STR#2505, Closes: #440256)
 
- -- Martin Pitt <mpitt at debian.org>  Tue, 11 Sep 2007 22:23:59 +0200
+ -- Martin Pitt <mpitt at debian.org>  Tue, 11 Sep 2007 22:43:06 +0200
 
 cupsys (1.3.0-3) unstable; urgency=low
 

Modified: cupsys/trunk/debian/patches/00list
==============================================================================
--- cupsys/trunk/debian/patches/00list	(original)
+++ cupsys/trunk/debian/patches/00list	Tue Sep 11 20:52:37 2007
@@ -1,4 +1,5 @@
 str2488-fix-localedir.dpatch
+str2505_localize.dpatch
 str2508-dont_kill_edit-config.tmpl.dpatch
 freebsd.dpatch
 removecvstag.dpatch

Added: cupsys/trunk/debian/patches/str2505_localize.dpatch
==============================================================================
--- (empty file)
+++ cupsys/trunk/debian/patches/str2505_localize.dpatch	Tue Sep 11 20:52:37 2007
@@ -0,0 +1,129 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## str2505_localize.dpatch by  <martin.pitt at ubuntu.com>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+ at DPATCH@
+diff -urNad trunk~/cups/localize.c trunk/cups/localize.c
+--- trunk~/cups/localize.c	2007-07-17 01:11:59.000000000 +0200
++++ trunk/cups/localize.c	2007-09-11 22:42:28.000000000 +0200
+@@ -44,7 +44,8 @@
+  * Local functions...
+  */
+ 
+-static void		ppd_ll_CC(char *ll_CC, char *ll);
++static void		ppd_ll_CC(char *ll_CC, int ll_CC_size,
++			          char *ll, int ll_size);
+ static ppd_attr_t	*ppd_localized_attr(ppd_file_t *ppd,
+ 			                    const char *keyword,
+ 			                    const char *spec, const char *ll_CC,
+@@ -90,7 +91,7 @@
+   * Get the default language...
+   */
+ 
+-  ppd_ll_CC(ll_CC, ll);
++  ppd_ll_CC(ll_CC, sizeof(ll_CC), ll, sizeof(ll));
+ 
+  /*
+   * Now lookup all of the groups, options, choices, etc.
+@@ -240,7 +241,7 @@
+   * Get the default language...
+   */
+ 
+-  ppd_ll_CC(ll_CC, ll);
++  ppd_ll_CC(ll_CC, sizeof(ll_CC), ll, sizeof(ll));
+ 
+  /*
+   * Find the localized attribute...
+@@ -391,8 +392,9 @@
+ 
+ static void
+ ppd_ll_CC(char *ll_CC,			/* O - Country-specific locale name */
+-          char *ll)			/* O - Generic locale name */
+-          
++          int  ll_CC_size,		/* I - Size of country-specific name */
++          char *ll,			/* O - Generic locale name */
++          int  ll_size)			/* I - Size of generic name */
+ {
+   cups_lang_t	*lang;			/* Current language */
+ 
+@@ -403,8 +405,8 @@
+ 
+   if ((lang = cupsLangDefault()) == NULL)
+   {
+-    strcpy(ll_CC, "en_US");
+-    strcpy(ll, "en");
++    strlcpy(ll_CC, "en_US", ll_CC_size);
++    strlcpy(ll, "en", ll_size);
+     return;
+   }
+ 
+@@ -412,8 +414,10 @@
+   * Copy the locale name...
+   */
+ 
+-  strlcpy(ll_CC, lang->language, sizeof(ll_CC));
+-  strlcpy(ll, lang->language, sizeof(ll));
++  strlcpy(ll_CC, lang->language, ll_CC_size);
++  strlcpy(ll, lang->language, ll_size);
++
++  DEBUG_printf(("ll_CC=\"%s\", ll=\"%s\"\n", ll_CC, ll));
+ 
+   if (strlen(ll_CC) == 2)
+   {
+@@ -423,16 +427,16 @@
+     */
+ 
+     if (!strcmp(ll_CC, "cs"))
+-      strcpy(ll_CC, "cs_CZ");
++      strlcpy(ll_CC, "cs_CZ", ll_CC_size);
+     else if (!strcmp(ll_CC, "en"))
+-      strcpy(ll_CC, "en_US");
++      strlcpy(ll_CC, "en_US", ll_CC_size);
+     else if (!strcmp(ll_CC, "ja"))
+-      strcpy(ll_CC, "ja_JP");
++      strlcpy(ll_CC, "ja_JP", ll_CC_size);
+     else if (!strcmp(ll_CC, "sv"))
+-      strcpy(ll_CC, "sv_SE");
+-    else if (!strcmp(ll_CC, "zh"))
+-      strcpy(ll_CC, "zh_CN");		/* Simplified Chinese */
+-    else
++      strlcpy(ll_CC, "sv_SE", ll_CC_size);
++    else if (!strcmp(ll_CC, "zh"))	/* Simplified Chinese */
++      strlcpy(ll_CC, "zh_CN", ll_CC_size);
++    else if (ll_CC_size >= 6)
+     {
+       ll_CC[2] = '_';
+       ll_CC[3] = toupper(ll_CC[0] & 255);
+@@ -475,8 +479,10 @@
+     snprintf(lkeyword, sizeof(lkeyword), "%s.%s", ll, keyword);
+     attr = ppdFindAttr(ppd, lkeyword, spec);
+ 
+-    if (!attr && !strcmp(ll, "ja"))
++    if (!attr)
+     {
++      if (!strcmp(ll, "ja"))
++      {
+      /*
+       * Due to a bug in the CUPS DDK 1.1.0 ppdmerge program, Japanese
+       * PPD files were incorrectly assigned "jp" as the locale name
+@@ -487,6 +493,18 @@
+       snprintf(lkeyword, sizeof(lkeyword), "jp.%s", keyword);
+       attr = ppdFindAttr(ppd, lkeyword, spec);
+     }
++      else if (!strcmp(ll, "no"))
++      {
++       /*
++	* Norway has two languages, "Bokmal" (the primary one)
++	* and "Nynorsk" (new Norwegian); we map "no" to "nb" here as
++	* recommended by the locale folks...
++	*/
++
++	snprintf(lkeyword, sizeof(lkeyword), "nb.%s", keyword);
++	attr = ppdFindAttr(ppd, lkeyword, spec);
++  }
++    }
+   }
+ 
+ #ifdef DEBUG



More information about the Pkg-cups-devel mailing list