]> git.sesse.net Git - vlc/blob - src/misc/iso_lang.c
Some heavy changes today:
[vlc] / src / misc / iso_lang.c
1 /*****************************************************************************
2  * iso_lang.c: function to decode language code (in dvd or a52 for instance).
3  *****************************************************************************
4  * Copyright (C) 1998-2001 VideoLAN
5  * $Id: iso_lang.c,v 1.3 2001/12/30 07:09:56 sam Exp $
6  *
7  * Author: Stéphane Borel <stef@via.ecp.fr>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  * 
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
22  *****************************************************************************/
23
24 /*****************************************************************************
25  * Preamble
26  *****************************************************************************/
27 #include <stdio.h>
28
29 #include <videolan/vlc.h>
30
31 /*****************************************************************************
32  * Local tables
33  *****************************************************************************/
34 static struct
35 {
36     char    p_code[3];
37     char    p_lang_long[20];
38 }
39
40 lang_tbl[] =
41 {
42     /* The ISO 639 language codes.
43      * Language names with * prefix are not spelled in their own language 
44      */
45     { "  ", "Not Specified" },
46     { "aa", "*Afar" },
47     { "ab", "*Abkhazian" },
48     { "af", "*Afrikaans" },
49     { "am", "*Amharic" },
50     { "ar", "*Arabic" },
51     { "as", "*Assamese" },
52     { "ay", "*Aymara" },
53     { "az", "*Azerbaijani" },
54     { "ba", "*Bashkir" },
55     { "be", "*Byelorussian" },
56     { "bg", "*Bulgarian" },
57     { "bh", "*Bihari" },
58     { "bi", "*Bislama" },
59     { "bn", "*Bengali; Bangla" },
60     { "bo", "*Tibetan" },
61     { "br", "*Breton" },
62     { "ca", "*Catalan" },
63     { "co", "*Corsican" },
64     { "cs", "*Czech(Ceske)" },
65     { "cy", "*Welsh" },
66     { "da", "Dansk" },
67     { "de", "Deutsch" },
68     { "dz", "*Bhutani" },
69     { "el", "*Greek" },
70     { "en", "English" },
71     { "eo", "*Esperanto" },
72     { "es", "Espanol" },
73     { "et", "*Estonian" },
74     { "eu", "*Basque" },
75     { "fa", "*Persian" },
76     { "fi", "Suomi" },
77     { "fj", "*Fiji" },
78     { "fo", "*Faroese" },
79     { "fr", "Francais" },
80     { "fy", "*Frisian" },
81     { "ga", "*Irish" },
82     { "gd", "*Scots Gaelic" },
83     { "gl", "*Galician" },
84     { "gn", "*Guarani" },
85     { "gu", "*Gujarati" },
86     { "ha", "*Hausa" },
87     { "he", "*Hebrew" },                                      /* formerly iw */
88     { "hi", "*Hindi" },
89     { "hr", "Hrvatski" },                                        /* Croatian */
90     { "hu", "Magyar" },
91     { "hy", "*Armenian" },
92     { "ia", "*Interlingua" },
93     { "id", "*Indonesian" },                                  /* formerly in */
94     { "ie", "*Interlingue" },
95     { "ik", "*Inupiak" },
96     { "in", "*Indonesian" },                               /* replaced by id */
97     { "is", "Islenska" },
98     { "it", "Italiano" },
99     { "iu", "*Inuktitut" },
100     { "iw", "*Hebrew" },                                   /* replaced by he */
101     { "ja", "*Japanese" },
102     { "ji", "*Yiddish" },                                  /* replaced by yi */
103     { "jw", "*Javanese" },
104     { "ka", "*Georgian" },
105     { "kk", "*Kazakh" },
106     { "kl", "*Greenlandic" },
107     { "km", "*Cambodian" },
108     { "kn", "*Kannada" },
109     { "ko", "*Korean" },
110     { "ks", "*Kashmiri" },
111     { "ku", "*Kurdish" },
112     { "ky", "*Kirghiz" },
113     { "la", "*Latin" },
114     { "ln", "*Lingala" },
115     { "lo", "*Laothian" },
116     { "lt", "*Lithuanian" },
117     { "lv", "*Latvian, Lettish" },
118     { "mg", "*Malagasy" },
119     { "mi", "*Maori" },
120     { "mk", "*Macedonian" },
121     { "ml", "*Malayalam" },
122     { "mn", "*Mongolian" },
123     { "mo", "*Moldavian" },
124     { "mr", "*Marathi" },
125     { "ms", "*Malay" },
126     { "mt", "*Maltese" },
127     { "my", "*Burmese" },
128     { "na", "*Nauru" },
129     { "ne", "*Nepali" },
130     { "nl", "Nederlands" },
131     { "no", "Norsk" },
132     { "oc", "*Occitan" },
133     { "om", "*(Afan) Oromo" },
134     { "or", "*Oriya" },
135     { "pa", "*Punjabi" },
136     { "pl", "*Polish" },
137     { "ps", "*Pashto, Pushto" },
138     { "pt", "Portugues" },
139     { "qu", "*Quechua" },
140     { "rm", "*Rhaeto-Romance" },
141     { "rn", "*Kirundi" },
142     { "ro", "*Romanian"  },
143     { "ru", "*Russian" },
144     { "rw", "*Kinyarwanda" },
145     { "sa", "*Sanskrit" },
146     { "sd", "*Sindhi" },
147     { "sg", "*Sangho" },
148     { "sh", "*Serbo-Croatian" },
149     { "si", "*Sinhalese" },
150     { "sk", "*Slovak" },
151     { "sl", "*Slovenian" },
152     { "sm", "*Samoan" },
153     { "sn", "*Shona"  },
154     { "so", "*Somali" },
155     { "sq", "*Albanian" },
156     { "sr", "*Serbian" },
157     { "ss", "*Siswati" },
158     { "st", "*Sesotho" },
159     { "su", "*Sundanese" },
160     { "sv", "Svenska" },
161     { "sw", "*Swahili" },
162     { "ta", "*Tamil" },
163     { "te", "*Telugu" },
164     { "tg", "*Tajik" },
165     { "th", "*Thai" },
166     { "ti", "*Tigrinya" },
167     { "tk", "*Turkmen" },
168     { "tl", "*Tagalog" },
169     { "tn", "*Setswana" },
170     { "to", "*Tonga" },
171     { "tr", "*Turkish" },
172     { "ts", "*Tsonga" },
173     { "tt", "*Tatar" },
174     { "tw", "*Twi" },
175     { "ug", "*Uighur" },
176     { "uk", "*Ukrainian" },
177     { "ur", "*Urdu" },
178     { "uz", "*Uzbek" },
179     { "vi", "*Vietnamese" },
180     { "vo", "*Volapuk" },
181     { "wo", "*Wolof" },
182     { "xh", "*Xhosa" },
183     { "yi", "*Yiddish" },                                     /* formerly ji */
184     { "yo", "*Yoruba" },
185     { "za", "*Zhuang" },
186     { "zh", "*Chinese" },
187     { "zu", "*Zulu" },
188     { "\0", "" }
189 };
190
191 /*****************************************************************************
192  * DecodeLanguage: gives the long language name from the two-letters
193  *                 ISO-639 code
194  *****************************************************************************/
195 char * DecodeLanguage( u16 i_code )
196 {
197     int     i = 0;
198
199     while( memcmp( lang_tbl[i].p_code, &i_code, 2 ) &&
200            lang_tbl[i].p_lang_long[0] )
201     {
202         i++;
203     }
204
205     return lang_tbl[i].p_lang_long;
206 }
207