diff options
Diffstat (limited to 'cups/localize.c')
-rw-r--r-- | cups/localize.c | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/cups/localize.c b/cups/localize.c index 551dde98e..7a98607de 100644 --- a/cups/localize.c +++ b/cups/localize.c @@ -1,5 +1,5 @@ /* - * "$Id: localize.c 7363 2008-03-03 22:19:24Z mike $" + * "$Id: localize.c 7679 2008-06-19 23:37:45Z mike $" * * PPD localization routines for the Common UNIX Printing System (CUPS). * @@ -26,6 +26,7 @@ * Contents: * * ppdLocalize() - Localize the PPD file to the current locale. + * ppdLocalizeAttr() - Localize an attribute. * ppdLocalizeIPPReason() - Get the localized version of a cupsIPPReason * attribute. * ppdLocalizeMarkerName() - Get the localized version of a marker-names @@ -196,6 +197,45 @@ ppdLocalize(ppd_file_t *ppd) /* I - PPD file */ /* + * 'ppdLocalizeAttr()' - Localize an attribute. + * + * This function uses the current locale to find the localized attribute for + * the given main and option keywords. If no localized version of the + * attribute exists for the current locale, the unlocalized version is returned. + */ + +ppd_attr_t * /* O - Localized attribute or @code NULL@ if none exists */ +ppdLocalizeAttr(ppd_file_t *ppd, /* I - PPD file */ + const char *keyword, /* I - Main keyword */ + const char *spec) /* I - Option keyword or @code NULL@ for none */ +{ + ppd_attr_t *locattr; /* Localized attribute */ + char ll_CC[6]; /* Language + country locale */ + + + /* + * Get the default language... + */ + + ppd_ll_CC(ll_CC, sizeof(ll_CC)); + + /* + * Find the localized attribute... + */ + + if (spec) + locattr = _ppdLocalizedAttr(ppd, keyword, spec, ll_CC); + else + locattr = _ppdLocalizedAttr(ppd, "Translation", keyword, ll_CC); + + if (!locattr) + locattr = ppdFindAttr(ppd, keyword, spec); + + return (locattr); +} + + +/* * 'ppdLocalizeIPPReason()' - Get the localized version of a cupsIPPReason * attribute. * @@ -666,5 +706,5 @@ ppd_ll_CC(char *ll_CC, /* O - Country-specific locale name */ /* - * End of "$Id: localize.c 7363 2008-03-03 22:19:24Z mike $". + * End of "$Id: localize.c 7679 2008-06-19 23:37:45Z mike $". */ |