New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CGIs always use english on OSX #2075

Closed
michaelrsweet opened this Issue Nov 2, 2006 · 2 comments

Comments

Projects
None yet
1 participant
@michaelrsweet
Collaborator

michaelrsweet commented Nov 2, 2006

Version: 1.2-current
CUPS.org User: jlovell

CGIs always use english on OSX because they aren't honoring the LANG environment variable. Attached patch is one way to fix it... To keep the patch small and to the point I omited indenting two blocks of code.

Comments?

Thanks!

@michaelrsweet

This comment has been minimized.

Collaborator

michaelrsweet commented Nov 2, 2006

CUPS.org User: mike

Thanks for the patch - committed with some minor indentation fixes.

@michaelrsweet

This comment has been minimized.

Collaborator

michaelrsweet commented Nov 2, 2006

"apple_lang.patch":

Index: config.h.in

--- config.h.in (revision 228)
+++ config.h.in (working copy)
@@ -443,6 +443,13 @@

/*

  • * Do we have CFLocaleCreateCanonicalLocaleIdentifierFromString()?
  • /
    +
    +#undef HAVE_CF_LOCALE_ID
    +
    +
    +/
    • Do we have MacOSX 10.4's mbr_XXX functions()?
      */

Index: cups/globals.h

--- cups/globals.h (revision 228)
+++ cups/globals.h (working copy)
@@ -98,11 +98,7 @@
/* language.c /
cups_lang_t *lang_default; /
Default language _/

ifdef APPLE

-# ifdef HAVE_CF_LOCALE_ID
char language[32]; /_ Cached language */
-# else

  • const char language; / Cached language /
    -# endif /
    HAVE_CF_LOCALE_ID */

endif /* APPLE */

/* ppd.c */

Index: cups/language.c

--- cups/language.c (revision 228)
+++ cups/language.c (working copy)
@@ -995,6 +995,7 @@
/* List of localization data /
CFStringRef languageName; /
Current name /
CFStringRef localeName; /
Canonical from of name */

  • char lang; / LANG environment variable _/
    _cups_globals_t *cg = cupsGlobals();
    /
    Pointer to library globals */

@@ -1005,6 +1006,10 @@

if (!cg->language[0])
{

  • if ((lang = getenv("LANG")))

  •  strlcpy(cg->language, lang, sizeof(cg->language));
    
  • else

  • {
    localizationList =
    CFPreferencesCopyAppValue(CFSTR("AppleLanguages"),
    kCFPreferencesCurrentApplication);
    @@ -1038,6 +1043,7 @@

    CFRelease(localizationList);
    }

  • }

/*

  • If we didn't find the language, default to en_US...
    @@ -1144,14 +1150,19 @@
    char buff[256]; /* Temporary buffer _/
    _cups_globals_t *cg = cupsGlobals();
    /
    Pointer to library globals */
  • char lang; / LANG environment variable */

/*

  • Only do the lookup and translation the first time.
    */

  • if (cg->language == NULL)

  • if (!cg->language[0])
    {

  • if ((lang = getenv("LANG")))

  •  strlcpy(cg->language, lang, sizeof(cg->language));
    
  • else

  • {
    localizationList =
    CFPreferencesCopyAppValue(CFSTR("AppleLanguages"),
    kCFPreferencesCurrentApplication);
    @@ -1180,7 +1191,8 @@
    {
    if (!strcasecmp(buff, apple_name_locale[i].name))
    {

  •   cg->language = apple_name_locale[i].locale;
    
  •   strlcpy(cg->language, apple_name_locale[i].locale, 
    
  •       sizeof(cg->language));
    break;
      }
    }
    

    @@ -1190,13 +1202,14 @@

    CFRelease(localizationList);
    }

  • }

/*

  • If we didn't find the language, default to en_US...
    */

  • if (cg->language == NULL)

  •  cg->language = apple_name_locale[0].locale;
    
  • if (!cg->language[0])

  •  strlcpy(cg->language, apple_name_locale[0].locale, sizeof(cg->language));
    

    }

    /*

@michaelrsweet michaelrsweet added this to the Stable milestone Mar 17, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment