]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - locale/po2strings.c
Add missing HTTP status message for 302 (moved temporarily).
[thirdparty/cups.git] / locale / po2strings.c
index 1edf146835bd364620a08ffcfc1da6cc3dd27c48..e8732407cf27aeff1b60cb2f9eb675133e65150d 100644 (file)
@@ -1,13 +1,9 @@
 /*
  * Convert a GNU gettext .po file to an Apple .strings file.
  *
- * Copyright 2007-2015 by Apple Inc.
+ * Copyright 2007-2017 by Apple Inc.
  *
- * These coded instructions, statements, and computer programs are the
- * property of Apple Inc. and are protected by Federal copyright
- * law.  Distribution and use rights are outlined in the file "LICENSE.txt"
- * which should have been included with this file.  If this file is
- * missing or damaged, see the license at "http://www.cups.org/".
+ * Licensed under Apache License v2.0.  See the file "LICENSE" for more information.
  *
  * Usage:
  *
@@ -323,32 +319,69 @@ normalize_string(const char *idstr,       /* I - msgid string */
       *bufptr++ = (char)0xA6;
       idstr += 2;
     }
-    else if (!html && *idstr == '\\' && idstr[1] == '\"' && (quote || strchr(idstr + 2, '\"') != NULL))
+    else if (!html && *idstr == '\\' && idstr[1] == '\"')
     {
       if (quote)
       {
        /*
-        * Convert \" to Unicode right (curley) double quote.
+        * Convert second \" to Unicode right (curley) double quote.
         */
 
        *bufptr++ = (char)0xE2;
        *bufptr++ = (char)0x80;
        *bufptr++ = (char)0x9D;
+       quote     = 0;
       }
-      else
+      else if (strchr(idstr + 2, '\"') != NULL)
       {
        /*
-        * Convert \" to Unicode left (curley) double quote.
+        * Convert first \" to Unicode left (curley) double quote.
         */
 
        *bufptr++ = (char)0xE2;
        *bufptr++ = (char)0x80;
        *bufptr++ = (char)0x9C;
+       quote     = 1;
+      }
+      else
+      {
+       /*
+        * Convert lone \" to Unicode double prime.
+        */
+
+        *bufptr++ = (char)0xE2;
+        *bufptr++ = (char)0x80;
+        *bufptr++ = (char)0xB3;
       }
 
-      quote = !quote;
       idstr ++;
     }
+    else if (*idstr == '\'')
+    {
+      if (strchr(idstr + 1, '\'') == NULL || quote)
+      {
+       /*
+        * Convert second ' (or ' used for a contraction) to Unicode right
+        * (curley) single quote.
+        */
+
+       *bufptr++ = (char)0xE2;
+       *bufptr++ = (char)0x80;
+       *bufptr++ = (char)0x99;
+       quote     = 0;
+      }
+      else
+      {
+       /*
+        * Convert first ' to Unicode left (curley) single quote.
+        */
+
+       *bufptr++ = (char)0xE2;
+       *bufptr++ = (char)0x80;
+       *bufptr++ = (char)0x98;
+       quote     = 1;
+      }
+    }
     else
       *bufptr++ = *idstr;