From b052deedae7221cdf197f55449734d0db3494664 Mon Sep 17 00:00:00 2001 From: Michael Sweet Date: Thu, 14 Apr 2016 12:09:35 -0400 Subject: [PATCH] Fix some localization issues with Norwegian. --- CHANGES.txt | 4 +++- cups/language.c | 18 ++++++++++++++++-- cups/ppd-localize.c | 13 ++++++++++++- ppdc/ppdc-catalog.cxx | 6 ++++-- 4 files changed, 35 insertions(+), 6 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index e57160005c..fb9d099401 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,4 @@ -CHANGES.txt - 2.2b1 - 2016-04-12 +CHANGES.txt - 2.2b1 - 2016-04-14 -------------------------------- CHANGES IN CUPS V2.2b1 @@ -27,4 +27,6 @@ CHANGES IN CUPS V2.2b1 () - Added a new cupsHashData API and support for hashed job passwords () + - Localization fixes (, + ) - Documentation changes (Issue #4781) diff --git a/cups/language.c b/cups/language.c index 32a2af641b..f1afeccd58 100644 --- a/cups/language.c +++ b/cups/language.c @@ -1,7 +1,7 @@ /* * I18N/language support for CUPS. * - * Copyright 2007-2015 by Apple Inc. + * Copyright 2007-2016 by Apple Inc. * Copyright 1997-2007 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -1335,6 +1335,18 @@ appleMessageLoad(const char *locale) /* I - Locale ID */ snprintf(filename, sizeof(filename), CUPS_BUNDLEDIR "/Resources/%s.lproj/cups.strings", locale); } + if (access(filename, 0)) + { + /* + * + * + * Try with just the language code... + */ + + strlcpy(baselang, locale, sizeof(baselang)); + snprintf(filename, sizeof(filename), CUPS_BUNDLEDIR "/Resources/%s.lproj/cups.strings", baselang); + } + DEBUG_printf(("1appleMessageLoad: filename=\"%s\"", filename)); if (access(filename, 0)) @@ -1345,7 +1357,9 @@ appleMessageLoad(const char *locale) /* I - Locale ID */ if (!strncmp(locale, "en", 2)) locale = "English"; - else if (!strncmp(locale, "nb", 2) || !strncmp(locale, "nl", 2)) + else if (!strncmp(locale, "nb", 2)) + locale = "no"; + else if (!strncmp(locale, "nl", 2)) locale = "Dutch"; else if (!strncmp(locale, "fr", 2)) locale = "French"; diff --git a/cups/ppd-localize.c b/cups/ppd-localize.c index 64d7108860..c20dbf9376 100644 --- a/cups/ppd-localize.c +++ b/cups/ppd-localize.c @@ -1,7 +1,7 @@ /* * PPD localization routines for CUPS. * - * Copyright 2007-2015 by Apple Inc. + * Copyright 2007-2016 by Apple Inc. * Copyright 1997-2007 by Easy Software Products, all rights reserved. * * These coded instructions, statements, and computer programs are the @@ -694,6 +694,17 @@ _ppdLocalizedAttr(ppd_file_t *ppd, /* I - PPD file */ snprintf(lkeyword, sizeof(lkeyword), "jp.%s", keyword); attr = ppdFindAttr(ppd, lkeyword, spec); } + else if (!strncmp(ll_CC, "nb", 2)) + { + /* + * Norway has two languages, "Bokmal" (the primary one) + * and "Nynorsk" (new Norwegian); this code maps from the (currently) + * recommended "nb" to the previously recommended "no"... + */ + + snprintf(lkeyword, sizeof(lkeyword), "no.%s", keyword); + attr = ppdFindAttr(ppd, lkeyword, spec); + } else if (!strncmp(ll_CC, "no", 2)) { /* diff --git a/ppdc/ppdc-catalog.cxx b/ppdc/ppdc-catalog.cxx index 854b58de00..ad7157bc56 100644 --- a/ppdc/ppdc-catalog.cxx +++ b/ppdc/ppdc-catalog.cxx @@ -1,7 +1,7 @@ // // Shared message catalog class for the CUPS PPD Compiler. // -// Copyright 2007-2014 by Apple Inc. +// Copyright 2007-2016 by Apple Inc. // Copyright 2002-2006 by Easy Software Products. // // These coded instructions, statements, and computer programs are the @@ -78,7 +78,9 @@ ppdcCatalog::ppdcCatalog(const char *l, // I - Locale if (!strncmp(l, "en", 2)) tl = "English"; - else if (!strncmp(l, "nb", 2) || !strncmp(l, "nl", 2)) + else if (!strncmp(l, "nb", 2)) + tl = "no"; + else if (!strncmp(l, "nl", 2)) tl = "Dutch"; else if (!strncmp(l, "fr", 2)) tl = "French"; -- 2.47.3