summaryrefslogtreecommitdiff
path: root/cups/localize.c
diff options
context:
space:
mode:
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>2008-06-27 20:26:20 +0000
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>2008-06-27 20:26:20 +0000
commit75bd9771f6e44fdd887ee90faac46f403aefc0fc (patch)
tree354e3067522df9490e905772f73b72bfed8733ae /cups/localize.c
parentdd1abb6b5f145c5e5f279d8848b5f3ec161fd227 (diff)
Merge changes from CUPS 1.4svn-r7696.
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@818 a1ca3aef-8c08-0410-bb20-df032aa958be
Diffstat (limited to 'cups/localize.c')
-rw-r--r--cups/localize.c44
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 $".
*/