/*
* 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:
*
*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;