Home | History | Annotate | Download | only in cups
      1 /*
      2  * Multi-language support for CUPS.
      3  *
      4  * Copyright 2007-2011 by Apple Inc.
      5  * Copyright 1997-2006 by Easy Software Products.
      6  *
      7  * These coded instructions, statements, and computer programs are the
      8  * property of Apple Inc. and are protected by Federal copyright
      9  * law.  Distribution and use rights are outlined in the file "LICENSE.txt"
     10  * which should have been included with this file.  If this file is
     11  * missing or damaged, see the license at "http://www.cups.org/".
     12  *
     13  * This file is subject to the Apple OS-Developed Software exception.
     14  */
     15 
     16 #ifndef _CUPS_LANGUAGE_H_
     17 #  define _CUPS_LANGUAGE_H_
     18 
     19 /*
     20  * Include necessary headers...
     21  */
     22 
     23 #  include <locale.h>
     24 #  include "array.h"
     25 
     26 #  ifdef __cplusplus
     27 extern "C" {
     28 #  endif /* __cplusplus */
     29 
     30 
     31 /*
     32  * Types...
     33  */
     34 
     35 typedef enum cups_encoding_e		/**** Language Encodings ****/
     36 {
     37   CUPS_AUTO_ENCODING = -1,		/* Auto-detect the encoding @private@ */
     38   CUPS_US_ASCII,			/* US ASCII */
     39   CUPS_ISO8859_1,			/* ISO-8859-1 */
     40   CUPS_ISO8859_2,			/* ISO-8859-2 */
     41   CUPS_ISO8859_3,			/* ISO-8859-3 */
     42   CUPS_ISO8859_4,			/* ISO-8859-4 */
     43   CUPS_ISO8859_5,			/* ISO-8859-5 */
     44   CUPS_ISO8859_6,			/* ISO-8859-6 */
     45   CUPS_ISO8859_7,			/* ISO-8859-7 */
     46   CUPS_ISO8859_8,			/* ISO-8859-8 */
     47   CUPS_ISO8859_9,			/* ISO-8859-9 */
     48   CUPS_ISO8859_10,			/* ISO-8859-10 */
     49   CUPS_UTF8,				/* UTF-8 */
     50   CUPS_ISO8859_13,			/* ISO-8859-13 */
     51   CUPS_ISO8859_14,			/* ISO-8859-14 */
     52   CUPS_ISO8859_15,			/* ISO-8859-15 */
     53   CUPS_WINDOWS_874,			/* CP-874 */
     54   CUPS_WINDOWS_1250,			/* CP-1250 */
     55   CUPS_WINDOWS_1251,			/* CP-1251 */
     56   CUPS_WINDOWS_1252,			/* CP-1252 */
     57   CUPS_WINDOWS_1253,			/* CP-1253 */
     58   CUPS_WINDOWS_1254,			/* CP-1254 */
     59   CUPS_WINDOWS_1255,			/* CP-1255 */
     60   CUPS_WINDOWS_1256,			/* CP-1256 */
     61   CUPS_WINDOWS_1257,			/* CP-1257 */
     62   CUPS_WINDOWS_1258,			/* CP-1258 */
     63   CUPS_KOI8_R,				/* KOI-8-R */
     64   CUPS_KOI8_U,				/* KOI-8-U */
     65   CUPS_ISO8859_11,			/* ISO-8859-11 */
     66   CUPS_ISO8859_16,			/* ISO-8859-16 */
     67   CUPS_MAC_ROMAN,			/* MacRoman */
     68   CUPS_ENCODING_SBCS_END = 63,		/* End of single-byte encodings @private@ */
     69 
     70   CUPS_WINDOWS_932,			/* Japanese JIS X0208-1990 */
     71   CUPS_WINDOWS_936,			/* Simplified Chinese GB 2312-80 */
     72   CUPS_WINDOWS_949,			/* Korean KS C5601-1992 */
     73   CUPS_WINDOWS_950,			/* Traditional Chinese Big Five */
     74   CUPS_WINDOWS_1361,			/* Korean Johab */
     75   CUPS_ENCODING_DBCS_END = 127,		/* End of double-byte encodings @private@ */
     76 
     77   CUPS_EUC_CN,				/* EUC Simplified Chinese */
     78   CUPS_EUC_JP,				/* EUC Japanese */
     79   CUPS_EUC_KR,				/* EUC Korean */
     80   CUPS_EUC_TW,				/* EUC Traditional Chinese */
     81   CUPS_JIS_X0213,			/* JIS X0213 aka Shift JIS */
     82   CUPS_ENCODING_VBCS_END = 191		/* End of variable-length encodings @private@ */
     83 } cups_encoding_t;
     84 
     85 typedef struct cups_lang_s		/**** Language Cache Structure ****/
     86 {
     87   struct cups_lang_s	*next;		/* Next language in cache */
     88   int			used;		/* Number of times this entry has been used. */
     89   cups_encoding_t	encoding;	/* Text encoding */
     90   char			language[16];	/* Language/locale name */
     91   cups_array_t		*strings;	/* Message strings @private@ */
     92 } cups_lang_t;
     93 
     94 
     95 /*
     96  * Prototypes...
     97  */
     98 
     99 extern cups_lang_t	*cupsLangDefault(void);
    100 extern const char	*cupsLangEncoding(cups_lang_t *lang);
    101 extern void		cupsLangFlush(void);
    102 extern void		cupsLangFree(cups_lang_t *lang);
    103 extern cups_lang_t	*cupsLangGet(const char *language);
    104 
    105 #  ifdef __cplusplus
    106 }
    107 #  endif /* __cplusplus */
    108 
    109 #endif /* !_CUPS_LANGUAGE_H_ */
    110