Volkan YILDIRIM <volkan@apb.com.tr>
[squirrelmail.git] / functions / i18n.php
CommitLineData
59177427 1<?php
1fd97780 2
35586184 3/**
4 * i18n.php
5 *
15e6162e 6 * Copyright (c) 1999-2002 The SquirrelMail Project Team
35586184 7 * Licensed under the GNU GPL. For full terms see the file COPYING.
8 *
9 * This file contains variuos functions that are needed to do
10 * internationalization of SquirrelMail.
11 *
12 * Internally the output character set is used. Other characters are
13 * encoded using Unicode entities according to HTML 4.0.
14 *
15 * $Id$
16 */
17
a2a7852b 18/* Decodes a string to the internal encoding from the given charset */
19function charset_decode ($charset, $string) {
6fbd125b 20 global $languages, $squirrelmail_language;
a2a7852b 21
3714db45 22 if (isset($languages[$squirrelmail_language]['XTRA_CODE']) &&
23 function_exists($languages[$squirrelmail_language]['XTRA_CODE'])) {
6fbd125b 24 $string = $languages[$squirrelmail_language]['XTRA_CODE']('decode', $string);
25 }
b05c8961 26
a2a7852b 27 /* All HTML special characters are 7 bit and can be replaced first */
28 $string = htmlspecialchars ($string);
29
30 $charset = strtolower($charset);
31
a2a7852b 32 if (ereg('iso-8859-([[:digit:]]+)', $charset, $res)) {
33 if ($res[1] == '1') {
34 $ret = charset_decode_iso_8859_1 ($string);
35 } else if ($res[1] == '2') {
36 $ret = charset_decode_iso_8859_2 ($string);
37 } else if ($res[1] == '7') {
38 $ret = charset_decode_iso_8859_7 ($string);
39 } else if ($res[1] == '15') {
40 $ret = charset_decode_iso_8859_15 ($string);
41 } else {
42 $ret = charset_decode_iso_8859_default ($string);
43 }
44 } else if ($charset == 'ns_4551-1') {
45 $ret = charset_decode_ns_4551_1 ($string);
46 } else if ($charset == 'koi8-r') {
47 $ret = charset_decode_koi8r ($string);
48 } else if ($charset == 'windows-1251') {
49 $ret = charset_decode_koi8r ($string);
50 } else {
51 $ret = $string;
52 }
53 return( $ret );
54}
55
56/*
57 iso-8859-1 is the same as Latin 1 and is normally used
58 in western europe.
59 */
60function charset_decode_iso_8859_1 ($string) {
61 global $default_charset;
13e0c649 62
a2a7852b 63 if (strtolower($default_charset) <> 'iso-8859-1') {
64 /* Only do the slow convert if there are 8-bit characters */
65 if (ereg("[\200-\377]", $string)) {
066c374f 66 $string = str_replace("\201", '&#129;', $string);
67 $string = str_replace("\202", '&#130;', $string);
68 $string = str_replace("\203", '&#131;', $string);
69 $string = str_replace("\204", '&#132;', $string);
70 $string = str_replace("\205", '&#133;', $string);
71 $string = str_replace("\206", '&#134;', $string);
72 $string = str_replace("\207", '&#135;', $string);
73 $string = str_replace("\210", '&#136;', $string);
74 $string = str_replace("\211", '&#137;', $string);
75 $string = str_replace("\212", '&#138;', $string);
76 $string = str_replace("\213", '&#139;', $string);
77 $string = str_replace("\214", '&#140;', $string);
78 $string = str_replace("\215", '&#141;', $string);
79 $string = str_replace("\216", '&#142;', $string);
80 $string = str_replace("\217", '&#143;', $string);
81 $string = str_replace("\220", '&#144;', $string);
82 $string = str_replace("\221", '&#145;', $string);
83 $string = str_replace("\222", '&#146;', $string);
84 $string = str_replace("\223", '&#147;', $string);
85 $string = str_replace("\224", '&#148;', $string);
86 $string = str_replace("\225", '&#149;', $string);
87 $string = str_replace("\226", '&#150;', $string);
88 $string = str_replace("\227", '&#151;', $string);
89 $string = str_replace("\230", '&#152;', $string);
90 $string = str_replace("\231", '&#153;', $string);
91 $string = str_replace("\232", '&#154;', $string);
92 $string = str_replace("\233", '&#155;', $string);
93 $string = str_replace("\234", '&#156;', $string);
94 $string = str_replace("\235", '&#157;', $string);
95 $string = str_replace("\236", '&#158;', $string);
96 $string = str_replace("\237", '&#159;', $string);
97 $string = str_replace("\240", '&#160;', $string);
98 $string = str_replace("\241", '&#161;', $string);
99 $string = str_replace("\242", '&#162;', $string);
100 $string = str_replace("\243", '&#163;', $string);
101 $string = str_replace("\244", '&#164;', $string);
102 $string = str_replace("\245", '&#165;', $string);
103 $string = str_replace("\246", '&#166;', $string);
104 $string = str_replace("\247", '&#167;', $string);
105 $string = str_replace("\250", '&#168;', $string);
106 $string = str_replace("\251", '&#169;', $string);
107 $string = str_replace("\252", '&#170;', $string);
108 $string = str_replace("\253", '&#171;', $string);
109 $string = str_replace("\254", '&#172;', $string);
110 $string = str_replace("\255", '&#173;', $string);
111 $string = str_replace("\256", '&#174;', $string);
112 $string = str_replace("\257", '&#175;', $string);
113 $string = str_replace("\260", '&#176;', $string);
114 $string = str_replace("\261", '&#177;', $string);
115 $string = str_replace("\262", '&#178;', $string);
116 $string = str_replace("\263", '&#179;', $string);
117 $string = str_replace("\264", '&#180;', $string);
118 $string = str_replace("\265", '&#181;', $string);
119 $string = str_replace("\266", '&#182;', $string);
120 $string = str_replace("\267", '&#183;', $string);
121 $string = str_replace("\270", '&#184;', $string);
122 $string = str_replace("\271", '&#185;', $string);
123 $string = str_replace("\272", '&#186;', $string);
124 $string = str_replace("\273", '&#187;', $string);
125 $string = str_replace("\274", '&#188;', $string);
126 $string = str_replace("\275", '&#189;', $string);
127 $string = str_replace("\276", '&#190;', $string);
128 $string = str_replace("\277", '&#191;', $string);
129 $string = str_replace("\300", '&#192;', $string);
130 $string = str_replace("\301", '&#193;', $string);
131 $string = str_replace("\302", '&#194;', $string);
132 $string = str_replace("\303", '&#195;', $string);
133 $string = str_replace("\304", '&#196;', $string);
134 $string = str_replace("\305", '&#197;', $string);
135 $string = str_replace("\306", '&#198;', $string);
136 $string = str_replace("\307", '&#199;', $string);
137 $string = str_replace("\310", '&#200;', $string);
138 $string = str_replace("\311", '&#201;', $string);
139 $string = str_replace("\312", '&#202;', $string);
140 $string = str_replace("\313", '&#203;', $string);
141 $string = str_replace("\314", '&#204;', $string);
142 $string = str_replace("\315", '&#205;', $string);
143 $string = str_replace("\316", '&#206;', $string);
144 $string = str_replace("\317", '&#207;', $string);
145 $string = str_replace("\320", '&#208;', $string);
146 $string = str_replace("\321", '&#209;', $string);
147 $string = str_replace("\322", '&#210;', $string);
148 $string = str_replace("\323", '&#211;', $string);
149 $string = str_replace("\324", '&#212;', $string);
150 $string = str_replace("\325", '&#213;', $string);
151 $string = str_replace("\326", '&#214;', $string);
152 $string = str_replace("\327", '&#215;', $string);
153 $string = str_replace("\330", '&#216;', $string);
154 $string = str_replace("\331", '&#217;', $string);
155 $string = str_replace("\332", '&#218;', $string);
156 $string = str_replace("\333", '&#219;', $string);
157 $string = str_replace("\334", '&#220;', $string);
158 $string = str_replace("\335", '&#221;', $string);
159 $string = str_replace("\336", '&#222;', $string);
160 $string = str_replace("\337", '&#223;', $string);
161 $string = str_replace("\340", '&#224;', $string);
162 $string = str_replace("\341", '&#225;', $string);
163 $string = str_replace("\342", '&#226;', $string);
164 $string = str_replace("\343", '&#227;', $string);
165 $string = str_replace("\344", '&#228;', $string);
166 $string = str_replace("\345", '&#229;', $string);
167 $string = str_replace("\346", '&#230;', $string);
168 $string = str_replace("\347", '&#231;', $string);
169 $string = str_replace("\350", '&#232;', $string);
170 $string = str_replace("\351", '&#233;', $string);
171 $string = str_replace("\352", '&#234;', $string);
172 $string = str_replace("\353", '&#235;', $string);
173 $string = str_replace("\354", '&#236;', $string);
174 $string = str_replace("\355", '&#237;', $string);
175 $string = str_replace("\356", '&#238;', $string);
176 $string = str_replace("\357", '&#239;', $string);
177 $string = str_replace("\360", '&#240;', $string);
178 $string = str_replace("\361", '&#241;', $string);
179 $string = str_replace("\362", '&#242;', $string);
180 $string = str_replace("\363", '&#243;', $string);
181 $string = str_replace("\364", '&#244;', $string);
182 $string = str_replace("\365", '&#245;', $string);
183 $string = str_replace("\366", '&#246;', $string);
184 $string = str_replace("\367", '&#247;', $string);
185 $string = str_replace("\370", '&#248;', $string);
186 $string = str_replace("\371", '&#249;', $string);
187 $string = str_replace("\372", '&#250;', $string);
188 $string = str_replace("\373", '&#251;', $string);
189 $string = str_replace("\374", '&#252;', $string);
190 $string = str_replace("\375", '&#253;', $string);
191 $string = str_replace("\376", '&#254;', $string);
192 $string = str_replace("\377", '&#255;', $string);
a2a7852b 193 }
194 }
195
196 return ($string);
197}
198
199/* iso-8859-2 is used for some eastern European languages */
200function charset_decode_iso_8859_2 ($string) {
201 global $default_charset;
202
203 if (strtolower($default_charset) == 'iso-8859-2')
204 return $string;
205
206 /* Only do the slow convert if there are 8-bit characters */
207 if (! ereg("[\200-\377]", $string))
208 return $string;
209
210 /* NO-BREAK SPACE */
211 $string = str_replace("\240", '&#160;', $string);
212 /* LATIN CAPITAL LETTER A WITH OGONEK */
213 $string = str_replace("\241", '&#260;', $string);
214 /* BREVE */
215 $string = str_replace("\242", '&#728;', $string);
216 // LATIN CAPITAL LETTER L WITH STROKE
217 $string = str_replace("\243", '&#321;', $string);
218 // CURRENCY SIGN
219 $string = str_replace("\244", '&#164;', $string);
220 // LATIN CAPITAL LETTER L WITH CARON
221 $string = str_replace("\245", '&#317;', $string);
222 // LATIN CAPITAL LETTER S WITH ACUTE
223 $string = str_replace("\246", '&#346;', $string);
224 // SECTION SIGN
225 $string = str_replace("\247", '&#167;', $string);
226 // DIAERESIS
227 $string = str_replace("\250", '&#168;', $string);
228 // LATIN CAPITAL LETTER S WITH CARON
229 $string = str_replace("\251", '&#352;', $string);
230 // LATIN CAPITAL LETTER S WITH CEDILLA
231 $string = str_replace("\252", '&#350;', $string);
232 // LATIN CAPITAL LETTER T WITH CARON
233 $string = str_replace("\253", '&#356;', $string);
234 // LATIN CAPITAL LETTER Z WITH ACUTE
235 $string = str_replace("\254", '&#377;', $string);
236 // SOFT HYPHEN
237 $string = str_replace("\255", '&#173;', $string);
238 // LATIN CAPITAL LETTER Z WITH CARON
239 $string = str_replace("\256", '&#381;', $string);
240 // LATIN CAPITAL LETTER Z WITH DOT ABOVE
241 $string = str_replace("\257", '&#379;', $string);
242 // DEGREE SIGN
243 $string = str_replace("\260", '&#176;', $string);
244 // LATIN SMALL LETTER A WITH OGONEK
245 $string = str_replace("\261", '&#261;', $string);
246 // OGONEK
247 $string = str_replace("\262", '&#731;', $string);
248 // LATIN SMALL LETTER L WITH STROKE
249 $string = str_replace("\263", '&#322;', $string);
250 // ACUTE ACCENT
251 $string = str_replace("\264", '&#180;', $string);
252 // LATIN SMALL LETTER L WITH CARON
253 $string = str_replace("\265", '&#318;', $string);
254 // LATIN SMALL LETTER S WITH ACUTE
255 $string = str_replace("\266", '&#347;', $string);
256 // CARON
257 $string = str_replace("\267", '&#711;', $string);
258 // CEDILLA
259 $string = str_replace("\270", '&#184;', $string);
260 // LATIN SMALL LETTER S WITH CARON
261 $string = str_replace("\271", '&#353;', $string);
262 // LATIN SMALL LETTER S WITH CEDILLA
263 $string = str_replace("\272", '&#351;', $string);
264 // LATIN SMALL LETTER T WITH CARON
265 $string = str_replace("\273", '&#357;', $string);
266 // LATIN SMALL LETTER Z WITH ACUTE
267 $string = str_replace("\274", '&#378;', $string);
268 // DOUBLE ACUTE ACCENT
269 $string = str_replace("\275", '&#733;', $string);
270 // LATIN SMALL LETTER Z WITH CARON
271 $string = str_replace("\276", '&#382;', $string);
272 // LATIN SMALL LETTER Z WITH DOT ABOVE
273 $string = str_replace("\277", '&#380;', $string);
274 // LATIN CAPITAL LETTER R WITH ACUTE
275 $string = str_replace("\300", '&#340;', $string);
276 // LATIN CAPITAL LETTER A WITH ACUTE
277 $string = str_replace("\301", '&#193;', $string);
278 // LATIN CAPITAL LETTER A WITH CIRCUMFLEX
279 $string = str_replace("\302", '&#194;', $string);
280 // LATIN CAPITAL LETTER A WITH BREVE
281 $string = str_replace("\303", '&#258;', $string);
282 // LATIN CAPITAL LETTER A WITH DIAERESIS
283 $string = str_replace("\304", '&#196;', $string);
284 // LATIN CAPITAL LETTER L WITH ACUTE
285 $string = str_replace("\305", '&#313;', $string);
286 // LATIN CAPITAL LETTER C WITH ACUTE
287 $string = str_replace("\306", '&#262;', $string);
288 // LATIN CAPITAL LETTER C WITH CEDILLA
289 $string = str_replace("\307", '&#199;', $string);
290 // LATIN CAPITAL LETTER C WITH CARON
291 $string = str_replace("\310", '&#268;', $string);
292 // LATIN CAPITAL LETTER E WITH ACUTE
293 $string = str_replace("\311", '&#201;', $string);
294 // LATIN CAPITAL LETTER E WITH OGONEK
295 $string = str_replace("\312", '&#280;', $string);
296 // LATIN CAPITAL LETTER E WITH DIAERESIS
297 $string = str_replace("\313", '&#203;', $string);
298 // LATIN CAPITAL LETTER E WITH CARON
299 $string = str_replace("\314", '&#282;', $string);
300 // LATIN CAPITAL LETTER I WITH ACUTE
301 $string = str_replace("\315", '&#205;', $string);
302 // LATIN CAPITAL LETTER I WITH CIRCUMFLEX
303 $string = str_replace("\316", '&#206;', $string);
304 // LATIN CAPITAL LETTER D WITH CARON
305 $string = str_replace("\317", '&#270;', $string);
306 // LATIN CAPITAL LETTER D WITH STROKE
307 $string = str_replace("\320", '&#272;', $string);
308 // LATIN CAPITAL LETTER N WITH ACUTE
309 $string = str_replace("\321", '&#323;', $string);
310 // LATIN CAPITAL LETTER N WITH CARON
311 $string = str_replace("\322", '&#327;', $string);
312 // LATIN CAPITAL LETTER O WITH ACUTE
313 $string = str_replace("\323", '&#211;', $string);
314 // LATIN CAPITAL LETTER O WITH CIRCUMFLEX
315 $string = str_replace("\324", '&#212;', $string);
316 // LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
317 $string = str_replace("\325", '&#336;', $string);
318 // LATIN CAPITAL LETTER O WITH DIAERESIS
319 $string = str_replace("\326", '&#214;', $string);
320 // MULTIPLICATION SIGN
321 $string = str_replace("\327", '&#215;', $string);
322 // LATIN CAPITAL LETTER R WITH CARON
323 $string = str_replace("\330", '&#344;', $string);
324 // LATIN CAPITAL LETTER U WITH RING ABOVE
325 $string = str_replace("\331", '&#366;', $string);
326 // LATIN CAPITAL LETTER U WITH ACUTE
327 $string = str_replace("\332", '&#218;', $string);
328 // LATIN CAPITAL LETTER U WITH DOUBLE ACUTE
329 $string = str_replace("\333", '&#368;', $string);
330 // LATIN CAPITAL LETTER U WITH DIAERESIS
331 $string = str_replace("\334", '&#220;', $string);
332 // LATIN CAPITAL LETTER Y WITH ACUTE
333 $string = str_replace("\335", '&#221;', $string);
334 // LATIN CAPITAL LETTER T WITH CEDILLA
335 $string = str_replace("\336", '&#354;', $string);
336 // LATIN SMALL LETTER SHARP S
337 $string = str_replace("\337", '&#223;', $string);
338 // LATIN SMALL LETTER R WITH ACUTE
339 $string = str_replace("\340", '&#341;', $string);
340 // LATIN SMALL LETTER A WITH ACUTE
341 $string = str_replace("\341", '&#225;', $string);
342 // LATIN SMALL LETTER A WITH CIRCUMFLEX
343 $string = str_replace("\342", '&#226;', $string);
344 // LATIN SMALL LETTER A WITH BREVE
345 $string = str_replace("\343", '&#259;', $string);
346 // LATIN SMALL LETTER A WITH DIAERESIS
347 $string = str_replace("\344", '&#228;', $string);
348 // LATIN SMALL LETTER L WITH ACUTE
349 $string = str_replace("\345", '&#314;', $string);
350 // LATIN SMALL LETTER C WITH ACUTE
351 $string = str_replace("\346", '&#263;', $string);
352 // LATIN SMALL LETTER C WITH CEDILLA
353 $string = str_replace("\347", '&#231;', $string);
354 // LATIN SMALL LETTER C WITH CARON
355 $string = str_replace("\350", '&#269;', $string);
356 // LATIN SMALL LETTER E WITH ACUTE
357 $string = str_replace("\351", '&#233;', $string);
358 // LATIN SMALL LETTER E WITH OGONEK
359 $string = str_replace("\352", '&#281;', $string);
360 // LATIN SMALL LETTER E WITH DIAERESIS
361 $string = str_replace("\353", '&#235;', $string);
362 // LATIN SMALL LETTER E WITH CARON
363 $string = str_replace("\354", '&#283;', $string);
364 // LATIN SMALL LETTER I WITH ACUTE
365 $string = str_replace("\355", '&#237;', $string);
366 // LATIN SMALL LETTER I WITH CIRCUMFLEX
367 $string = str_replace("\356", '&#238;', $string);
368 // LATIN SMALL LETTER D WITH CARON
369 $string = str_replace("\357", '&#271;', $string);
370 // LATIN SMALL LETTER D WITH STROKE
371 $string = str_replace("\360", '&#273;', $string);
372 // LATIN SMALL LETTER N WITH ACUTE
373 $string = str_replace("\361", '&#324;', $string);
374 // LATIN SMALL LETTER N WITH CARON
375 $string = str_replace("\362", '&#328;', $string);
376 // LATIN SMALL LETTER O WITH ACUTE
377 $string = str_replace("\363", '&#243;', $string);
378 // LATIN SMALL LETTER O WITH CIRCUMFLEX
379 $string = str_replace("\364", '&#244;', $string);
380 // LATIN SMALL LETTER O WITH DOUBLE ACUTE
381 $string = str_replace("\365", '&#337;', $string);
382 // LATIN SMALL LETTER O WITH DIAERESIS
383 $string = str_replace("\366", '&#246;', $string);
384 // DIVISION SIGN
385 $string = str_replace("\367", '&#247;', $string);
386 // LATIN SMALL LETTER R WITH CARON
387 $string = str_replace("\370", '&#345;', $string);
388 // LATIN SMALL LETTER U WITH RING ABOVE
389 $string = str_replace("\371", '&#367;', $string);
390 // LATIN SMALL LETTER U WITH ACUTE
391 $string = str_replace("\372", '&#250;', $string);
392 // LATIN SMALL LETTER U WITH DOUBLE ACUTE
393 $string = str_replace("\373", '&#369;', $string);
394 // LATIN SMALL LETTER U WITH DIAERESIS
395 $string = str_replace("\374", '&#252;', $string);
396 // LATIN SMALL LETTER Y WITH ACUTE
397 $string = str_replace("\375", '&#253;', $string);
398 // LATIN SMALL LETTER T WITH CEDILLA
399 $string = str_replace("\376", '&#355;', $string);
400 // DOT ABOVE
401 $string = str_replace("\377", '&#729;', $string);
402
403 return $string;
404}
405
406/* iso-8859-7 is Greek. */
407function charset_decode_iso_8859_7 ($string) {
408 global $default_charset;
409
410 if (strtolower($default_charset) == 'iso-8859-7') {
411 return $string;
412 }
413
414 /* Only do the slow convert if there are 8-bit characters */
415 if (!ereg("[\200-\377]", $string)) {
416 return $string;
417 }
418
419 /* Some diverse characters in the beginning */
420 $string = str_replace("\240", '&#160;', $string);
421 $string = str_replace("\241", '&#8216;', $string);
422 $string = str_replace("\242", '&#8217;', $string);
423 $string = str_replace("\243", '&#163;', $string);
424 $string = str_replace("\246", '&#166;', $string);
425 $string = str_replace("\247", '&#167;', $string);
426 $string = str_replace("\250", '&#168;', $string);
427 $string = str_replace("\251", '&#169;', $string);
428 $string = str_replace("\253", '&#171;', $string);
429 $string = str_replace("\254", '&#172;', $string);
430 $string = str_replace("\255", '&#173;', $string);
431 $string = str_replace("\257", '&#8213;', $string);
432 $string = str_replace("\260", '&#176;', $string);
433 $string = str_replace("\261", '&#177;', $string);
434 $string = str_replace("\262", '&#178;', $string);
435 $string = str_replace("\263", '&#179;', $string);
436
437 /* Horizontal bar (parentheki pavla) */
438 $string = str_replace ("\257", '&#8213;', $string);
439
440 /*
441 * ISO-8859-7 characters from 11/04 (0xB4) to 11/06 (0xB6)
442 * These are Unicode 900-902
443 */
49c17806 444 $string = preg_replace("/([\264-\266])/","'&#' . (ord(\\1)+720)",$string);
445
a2a7852b 446 /* 11/07 (0xB7) Middle dot is the same in iso-8859-1 */
447 $string = str_replace("\267", '&#183;', $string);
448
449 /*
450 * ISO-8859-7 characters from 11/08 (0xB8) to 11/10 (0xBA)
451 * These are Unicode 900-902
452 */
49c17806 453 $string = preg_replace("/([\270-\272])/","'&#' . (ord(\\1)+720)",$string);
a2a7852b 454
455 /*
456 * 11/11 (0xBB) Right angle quotation mark is the same as in
457 * iso-8859-1
458 */
459 $string = str_replace("\273", '&#187;', $string);
460
461 /* And now the rest of the charset */
49c17806 462 $string = preg_replace("/([\274-\376])/","'&#' . (ord(\\1)+720)",$string);
a2a7852b 463
464 return $string;
465}
466
467/*
468 * iso-8859-15 is Latin 9 and has very much the same use as Latin 1
469 * but has the Euro symbol and some characters needed for French.
470 */
471function charset_decode_iso_8859_15 ($string) {
472 // Euro sign
473 $string = str_replace ("\244", '&#8364;', $string);
474 // Latin capital letter S with caron
84556805 475 $string = str_replace ("\246", '&#352;', $string);
a2a7852b 476 // Latin small letter s with caron
477 $string = str_replace ("\250", '&#353;', $string);
478 // Latin capital letter Z with caron
479 $string = str_replace ("\264", '&#381;', $string);
480 // Latin small letter z with caron
481 $string = str_replace ("\270", '&#382;', $string);
482 // Latin capital ligature OE
483 $string = str_replace ("\274", '&#338;', $string);
484 // Latin small ligature oe
485 $string = str_replace ("\275", '&#339;', $string);
486 // Latin capital letter Y with diaeresis
487 $string = str_replace ("\276", '&#376;', $string);
488
489 return (charset_decode_iso_8859_1($string));
490}
491
84556805 492/* ISO-8859-5 is Cyrillic */
a2a7852b 493function charset_decode_iso_8859_5 ($string) {
494 // Convert to KOI8-R, then return this decoded.
495 $string = convert_cyr_string($string, 'i', 'k');
496 return charset_decode_koi8r($string);
497}
498
499/* Remove all 8 bit characters from all other ISO-8859 character sets */
500function charset_decode_iso_8859_default ($string) {
501 return (strtr($string, "\240\241\242\243\244\245\246\247".
1fd97780 502 "\250\251\252\253\254\255\256\257".
503 "\260\261\262\263\264\265\266\267".
504 "\270\271\272\273\274\275\276\277".
505 "\300\301\302\303\304\305\306\307".
506 "\310\311\312\313\314\315\316\317".
507 "\320\321\322\323\324\325\326\327".
508 "\330\331\332\333\334\335\336\337".
509 "\340\341\342\343\344\345\346\347".
510 "\350\351\352\353\354\355\356\357".
511 "\360\361\362\363\364\365\366\367".
a2a7852b 512 "\370\371\372\373\374\375\376\377",
1fd97780 513 "????????????????????????????????????????".
514 "????????????????????????????????????????".
515 "????????????????????????????????????????".
516 "????????"));
a2a7852b 517
518}
519
520/*
521 * This is the same as ISO-646-NO and is used by some
522 * Microsoft programs when sending Norwegian characters
523 */
524function charset_decode_ns_4551_1 ($string) {
525 /*
526 * These characters are:
527 * Latin capital letter AE
528 * Latin capital letter O with stroke
529 * Latin capital letter A with ring above
530 * and the same as small letters
531 */
532 return strtr ($string, "[\\]{|}", "");
533}
534
535/*
536 * KOI8-R is used to encode Russian mail (Cyrrilic). Defined in RFC
537 * 1489.
538 */
539function charset_decode_koi8r ($string) {
540 global $default_charset;
541
542 if ($default_charset == 'koi8-r') {
543 return $string;
544 }
545
546 /*
547 * Convert to Unicode HTML entities.
548 * This code is rather ineffective.
549 */
550 $string = str_replace("\200", '&#9472;', $string);
551 $string = str_replace("\201", '&#9474;', $string);
552 $string = str_replace("\202", '&#9484;', $string);
553 $string = str_replace("\203", '&#9488;', $string);
554 $string = str_replace("\204", '&#9492;', $string);
555 $string = str_replace("\205", '&#9496;', $string);
556 $string = str_replace("\206", '&#9500;', $string);
557 $string = str_replace("\207", '&#9508;', $string);
558 $string = str_replace("\210", '&#9516;', $string);
559 $string = str_replace("\211", '&#9524;', $string);
560 $string = str_replace("\212", '&#9532;', $string);
561 $string = str_replace("\213", '&#9600;', $string);
562 $string = str_replace("\214", '&#9604;', $string);
563 $string = str_replace("\215", '&#9608;', $string);
564 $string = str_replace("\216", '&#9612;', $string);
565 $string = str_replace("\217", '&#9616;', $string);
566 $string = str_replace("\220", '&#9617;', $string);
567 $string = str_replace("\221", '&#9618;', $string);
568 $string = str_replace("\222", '&#9619;', $string);
569 $string = str_replace("\223", '&#8992;', $string);
570 $string = str_replace("\224", '&#9632;', $string);
571 $string = str_replace("\225", '&#8729;', $string);
572 $string = str_replace("\226", '&#8730;', $string);
573 $string = str_replace("\227", '&#8776;', $string);
574 $string = str_replace("\230", '&#8804;', $string);
575 $string = str_replace("\231", '&#8805;', $string);
576 $string = str_replace("\232", '&#160;', $string);
577 $string = str_replace("\233", '&#8993;', $string);
578 $string = str_replace("\234", '&#176;', $string);
579 $string = str_replace("\235", '&#178;', $string);
580 $string = str_replace("\236", '&#183;', $string);
581 $string = str_replace("\237", '&#247;', $string);
582 $string = str_replace("\240", '&#9552;', $string);
583 $string = str_replace("\241", '&#9553;', $string);
584 $string = str_replace("\242", '&#9554;', $string);
585 $string = str_replace("\243", '&#1105;', $string);
586 $string = str_replace("\244", '&#9555;', $string);
587 $string = str_replace("\245", '&#9556;', $string);
588 $string = str_replace("\246", '&#9557;', $string);
589 $string = str_replace("\247", '&#9558;', $string);
590 $string = str_replace("\250", '&#9559;', $string);
591 $string = str_replace("\251", '&#9560;', $string);
592 $string = str_replace("\252", '&#9561;', $string);
593 $string = str_replace("\253", '&#9562;', $string);
594 $string = str_replace("\254", '&#9563;', $string);
595 $string = str_replace("\255", '&#9564;', $string);
596 $string = str_replace("\256", '&#9565;', $string);
597 $string = str_replace("\257", '&#9566;', $string);
598 $string = str_replace("\260", '&#9567;', $string);
599 $string = str_replace("\261", '&#9568;', $string);
600 $string = str_replace("\262", '&#9569;', $string);
601 $string = str_replace("\263", '&#1025;', $string);
602 $string = str_replace("\264", '&#9570;', $string);
603 $string = str_replace("\265", '&#9571;', $string);
604 $string = str_replace("\266", '&#9572;', $string);
605 $string = str_replace("\267", '&#9573;', $string);
606 $string = str_replace("\270", '&#9574;', $string);
607 $string = str_replace("\271", '&#9575;', $string);
608 $string = str_replace("\272", '&#9576;', $string);
609 $string = str_replace("\273", '&#9577;', $string);
610 $string = str_replace("\274", '&#9578;', $string);
611 $string = str_replace("\275", '&#9579;', $string);
612 $string = str_replace("\276", '&#9580;', $string);
613 $string = str_replace("\277", '&#169;', $string);
614 $string = str_replace("\300", '&#1102;', $string);
615 $string = str_replace("\301", '&#1072;', $string);
616 $string = str_replace("\302", '&#1073;', $string);
617 $string = str_replace("\303", '&#1094;', $string);
618 $string = str_replace("\304", '&#1076;', $string);
619 $string = str_replace("\305", '&#1077;', $string);
620 $string = str_replace("\306", '&#1092;', $string);
621 $string = str_replace("\307", '&#1075;', $string);
622 $string = str_replace("\310", '&#1093;', $string);
623 $string = str_replace("\311", '&#1080;', $string);
624 $string = str_replace("\312", '&#1081;', $string);
625 $string = str_replace("\313", '&#1082;', $string);
626 $string = str_replace("\314", '&#1083;', $string);
627 $string = str_replace("\315", '&#1084;', $string);
628 $string = str_replace("\316", '&#1085;', $string);
629 $string = str_replace("\317", '&#1086;', $string);
630 $string = str_replace("\320", '&#1087;', $string);
631 $string = str_replace("\321", '&#1103;', $string);
632 $string = str_replace("\322", '&#1088;', $string);
633 $string = str_replace("\323", '&#1089;', $string);
634 $string = str_replace("\324", '&#1090;', $string);
635 $string = str_replace("\325", '&#1091;', $string);
636 $string = str_replace("\326", '&#1078;', $string);
637 $string = str_replace("\327", '&#1074;', $string);
638 $string = str_replace("\330", '&#1100;', $string);
639 $string = str_replace("\331", '&#1099;', $string);
640 $string = str_replace("\332", '&#1079;', $string);
641 $string = str_replace("\333", '&#1096;', $string);
642 $string = str_replace("\334", '&#1101;', $string);
643 $string = str_replace("\335", '&#1097;', $string);
644 $string = str_replace("\336", '&#1095;', $string);
645 $string = str_replace("\337", '&#1098;', $string);
646 $string = str_replace("\340", '&#1070;', $string);
647 $string = str_replace("\341", '&#1040;', $string);
648 $string = str_replace("\342", '&#1041;', $string);
649 $string = str_replace("\343", '&#1062;', $string);
650 $string = str_replace("\344", '&#1044;', $string);
651 $string = str_replace("\345", '&#1045;', $string);
652 $string = str_replace("\346", '&#1060;', $string);
653 $string = str_replace("\347", '&#1043;', $string);
654 $string = str_replace("\350", '&#1061;', $string);
655 $string = str_replace("\351", '&#1048;', $string);
656 $string = str_replace("\352", '&#1049;', $string);
657 $string = str_replace("\353", '&#1050;', $string);
658 $string = str_replace("\354", '&#1051;', $string);
659 $string = str_replace("\355", '&#1052;', $string);
660 $string = str_replace("\356", '&#1053;', $string);
661 $string = str_replace("\357", '&#1054;', $string);
662 $string = str_replace("\360", '&#1055;', $string);
663 $string = str_replace("\361", '&#1071;', $string);
664 $string = str_replace("\362", '&#1056;', $string);
665 $string = str_replace("\363", '&#1057;', $string);
666 $string = str_replace("\364", '&#1058;', $string);
667 $string = str_replace("\365", '&#1059;', $string);
668 $string = str_replace("\366", '&#1046;', $string);
669 $string = str_replace("\367", '&#1042;', $string);
670 $string = str_replace("\370", '&#1068;', $string);
671 $string = str_replace("\371", '&#1067;', $string);
672 $string = str_replace("\372", '&#1047;', $string);
673 $string = str_replace("\373", '&#1064;', $string);
674 $string = str_replace("\374", '&#1069;', $string);
675 $string = str_replace("\375", '&#1065;', $string);
676 $string = str_replace("\376", '&#1063;', $string);
677 $string = str_replace("\377", '&#1066;', $string);
678
679 return $string;
680}
681
6fbd125b 682
a2a7852b 683/*
6fbd125b 684 * Japanese charset extra function
685 *
b05c8961 686 */
6fbd125b 687function japanese_charset_xtra() {
688 $ret = func_get_arg(1); /* default return value */
689 if (function_exists('mb_detect_encoding')) {
690 switch (func_get_arg(0)) { /* action */
691 case 'decode':
692 $detect_encoding = mb_detect_encoding($ret);
693 if ($detect_encoding == 'JIS' ||
694 $detect_encoding == 'EUC-JP' ||
695 $detect_encoding == 'SJIS') {
696
697 $ret = mb_convert_encoding($ret, 'EUC-JP', 'AUTO');
698 }
699 break;
700 case 'encode':
701 $detect_encoding = mb_detect_encoding($ret);
702 if ($detect_encoding == 'JIS' ||
703 $detect_encoding == 'EUC-JP' ||
704 $detect_encoding == 'SJIS') {
705
706 $ret = mb_convert_encoding($ret, 'JIS', 'AUTO');
707 }
708 break;
709 case 'strimwidth':
710 $width = func_get_arg(2);
711 $ret = mb_strimwidth($ret, 0, $width, '...');
712 break;
713 case 'encodeheader':
714 $ret = mb_encode_mimeheader($ret);
715 break;
716 case 'decodeheader':
717 $ret = str_replace("\t", "", $ret);
718 if (eregi('=\\?([^?]+)\\?(q|b)\\?([^?]+)\\?=', $ret))
719 $ret = mb_decode_mimeheader($ret);
720 $ret = mb_convert_encoding($ret, 'EUC-JP', 'AUTO');
721 break;
722 case 'downloadfilename':
723 $useragent = func_get_arg(2);
724 if (strstr($useragent, 'Windows') !== false ||
725 strstr($useragent, 'Mac_') !== false) {
726 $ret = mb_convert_encoding($ret, 'SJIS', 'AUTO');
727 } else {
728 $ret = mb_convert_encoding($ret, 'EUC-JP', 'AUTO');
b05c8961 729}
6fbd125b 730 break;
731 default:
732 break;
b05c8961 733 }
734 }
6fbd125b 735 return $ret;
b05c8961 736}
737
6fbd125b 738
b05c8961 739/*
a2a7852b 740 * Set up the language to be output
741 * if $do_search is true, then scan the browser information
742 * for a possible language that we know
743 */
744function set_up_language($sm_language, $do_search = false) {
745
746 static $SetupAlready = 0;
747 global $HTTP_ACCEPT_LANGUAGE, $use_gettext, $languages,
748 $squirrelmail_language, $squirrelmail_default_language,
749 $sm_notAlias;
750
751 if ($SetupAlready) {
752 return;
753 }
5c920668 754 $SetupAlready = TRUE;
a2a7852b 755
756 if ($do_search && ! $sm_language && isset($HTTP_ACCEPT_LANGUAGE)) {
757 $sm_language = substr($HTTP_ACCEPT_LANGUAGE, 0, 2);
758 }
66d7950f 759
a2a7852b 760 if (!$sm_language && isset($squirrelmail_default_language)) {
761 $squirrelmail_language = $squirrelmail_default_language;
66d7950f 762 $sm_language = $squirrelmail_default_language;
a2a7852b 763 }
764 $sm_notAlias = $sm_language;
765 while (isset($languages[$sm_notAlias]['ALIAS'])) {
766 $sm_notAlias = $languages[$sm_notAlias]['ALIAS'];
767 }
768
88cb1b4d 769 if ( isset($sm_language) &&
5c920668 770 $use_gettext &&
771 $sm_language != '' &&
772 isset($languages[$sm_notAlias]['CHARSET']) ) {
773 bindtextdomain( 'squirrelmail', '../locale/' );
88cb1b4d 774 textdomain( 'squirrelmail' );
775 if ( !ini_get('safe_mode') &&
5c920668 776 getenv( 'LC_ALL' ) != $sm_notAlias ) {
777 putenv( "LC_ALL=$sm_notAlias" );
778 putenv( "LANG=$sm_notAlias" );
779 putenv( "LANGUAGE=$sm_notAlias" );
a2a7852b 780 }
88cb1b4d 781 setlocale(LC_ALL, $sm_notAlias);
5c920668 782 $squirrelmail_language = $sm_notAlias;
538f1ab7 783 if ($squirrelmail_language == 'ja_JP' && function_exists('mb_detect_encoding') ) {
b05c8961 784 header ('Content-Type: text/html; charset=EUC-JP');
785 if (!function_exists('mb_internal_encoding')) {
786 echo _("You need to have php4 installed with the multibyte string function enabled (using configure option --with-mbstring).");
787 }
788 mb_internal_encoding('EUC-JP');
789 mb_http_output('pass');
790 } else {
5c920668 791 header( 'Content-Type: text/html; charset=' . $languages[$sm_notAlias]['CHARSET'] );
a2a7852b 792 }
793}
b05c8961 794}
a2a7852b 795
796function set_my_charset(){
797
798 /*
799 * There can be a $default_charset setting in the
800 * config.php file, but the user may have a different language
801 * selected for a user interface. This function checks the
802 * language selected by the user and tags the outgoing messages
803 * with the appropriate charset corresponding to the language
804 * selection. This is "more right" (tm), than just stamping the
805 * message blindly with the system-wide $default_charset.
806 */
807 global $data_dir, $username, $default_charset, $languages;
88cb1b4d 808
a2a7852b 809 $my_language = getPref($data_dir, $username, 'language');
5c920668 810 if (!$my_language) {
811 return;
812 }
a2a7852b 813 while (isset($languages[$my_language]['ALIAS'])) {
f7e8861e 814 $my_language = $languages[$my_language]['ALIAS'];
a2a7852b 815 }
5c920668 816 $my_charset = $languages[$my_language]['CHARSET'];
a2a7852b 817 if ($my_charset) {
818 $default_charset = $my_charset;
819 }
820}
821
a2a7852b 822/* ------------------------------ main --------------------------- */
823
5c920668 824global $squirrelmail_language, $languages, $use_gettext;
825
a2a7852b 826if (! isset($squirrelmail_language)) {
827 $squirrelmail_language = '';
828}
829
830/* This array specifies the available languages. */
5c920668 831
832// The glibc locale is ca_ES.
833
834$languages['ca_ES']['NAME'] = 'Catalan';
835$languages['ca_ES']['CHARSET'] = 'iso-8859-1';
836$languages['ca']['ALIAS'] = 'ca_ES';
837
a2a7852b 838$languages['cs_CZ']['NAME'] = 'Czech';
839$languages['cs_CZ']['CHARSET'] = 'iso-8859-2';
840$languages['cs']['ALIAS'] = 'cs_CZ';
a2a7852b 841
5c920668 842// Danish locale is da_DK.
843
844$languages['da_DK']['NAME'] = 'Danish';
845$languages['da_DK']['CHARSET'] = 'iso-8859-1';
846$languages['da']['ALIAS'] = 'da_DK';
847
848$languages['de_DE']['NAME'] = 'Deutsch';
849$languages['de_DE']['CHARSET'] = 'iso-8859-1';
850$languages['de']['ALIAS'] = 'de_DE';
a2a7852b 851
5c920668 852// There is no en_EN! There is en_US, en_BR, en_AU, and so forth,
853// but who cares about !US, right? Right? :)
a2a7852b 854
5c920668 855$languages['en_US']['NAME'] = 'English';
856$languages['en_US']['CHARSET'] = 'iso-8859-1';
857$languages['en']['ALIAS'] = 'en_US';
a2a7852b 858
5c920668 859$languages['es_ES']['NAME'] = 'Spanish';
860$languages['es_ES']['CHARSET'] = 'iso-8859-1';
861$languages['es']['ALIAS'] = 'es_ES';
a2a7852b 862
5c920668 863$languages['et_EE']['NAME'] = 'Estonian';
864$languages['et_EE']['CHARSET'] = 'iso-8859-15';
865$languages['et']['ALIAS'] = 'et_EE';
a2a7852b 866
5c920668 867$languages['fi_FI']['NAME'] = 'Finnish';
868$languages['fi_FI']['CHARSET'] = 'iso-8859-1';
869$languages['fi']['ALIAS'] = 'fi_FI';
a2a7852b 870
5c920668 871$languages['fr_FR']['NAME'] = 'French';
872$languages['fr_FR']['CHARSET'] = 'iso-8859-1';
873$languages['fr']['ALIAS'] = 'fr_FR';
a2a7852b 874
5c920668 875$languages['hr_HR']['NAME'] = 'Croatian';
876$languages['hr_HR']['CHARSET'] = 'iso-8859-2';
877$languages['hr']['ALIAS'] = 'hr_HR';
a2a7852b 878
5c920668 879$languages['hu_HU']['NAME'] = 'Hungarian';
880$languages['hu_HU']['CHARSET'] = 'iso-8859-2';
881$languages['hu']['ALIAS'] = 'hu_HU';
a2a7852b 882
5c920668 883$languages['id_ID']['NAME'] = 'Indonesian';
884$languages['id_ID']['CHARSET'] = 'iso-8859-1';
885$languages['id']['ALIAS'] = 'id_ID';
a2a7852b 886
5c920668 887$languages['is_IS']['NAME'] = 'Icelandic';
888$languages['is_IS']['CHARSET'] = 'iso-8859-1';
889$languages['is']['ALIAS'] = 'is_IS';
a2a7852b 890
5c920668 891$languages['it_IT']['NAME'] = 'Italian';
892$languages['it_IT']['CHARSET'] = 'iso-8859-1';
893$languages['it']['ALIAS'] = 'it_IT';
a2a7852b 894
b05c8961 895$languages['ja_JP']['NAME'] = 'Japanese';
896$languages['ja_JP']['CHARSET'] = 'iso-2022-jp';
6fbd125b 897$languages['ja_JP']['XTRA_CODE'] = 'japanese_charset_xtra';
b05c8961 898$languages['ja']['ALIAS'] = 'ja_JP';
899
5c920668 900$languages['ko_KR']['NAME'] = 'Korean';
901$languages['ko_KR']['CHARSET'] = 'euc-KR';
902$languages['ko']['ALIAS'] = 'ko_KR';
a2a7852b 903
5c920668 904$languages['nl_NL']['NAME'] = 'Dutch';
905$languages['nl_NL']['CHARSET'] = 'iso-8859-1';
906$languages['nl']['ALIAS'] = 'nl_NL';
a2a7852b 907
5c920668 908$languages['no_NO']['NAME'] = 'Norwegian (Bokm&aring;l)';
909$languages['no_NO']['CHARSET'] = 'iso-8859-1';
910$languages['no']['ALIAS'] = 'no_NO';
b8b4ac4a 911$languages['nn_NO']['NAME'] = 'Norwegian (Nynorsk)';
912$languages['nn_NO']['CHARSET'] = 'iso-8859-1';
a2a7852b 913
5c920668 914$languages['pl_PL']['NAME'] = 'Polish';
915$languages['pl_PL']['CHARSET'] = 'iso-8859-2';
916$languages['pl']['ALIAS'] = 'pl_PL';
a2a7852b 917
5c920668 918$languages['pt_PT']['NAME'] = 'Portuguese (Portugal)';
919$languages['pt_PT']['CHARSET'] = 'iso-8859-1';
a2a7852b 920$languages['pt_BR']['NAME'] = 'Portuguese (Brazil)';
921$languages['pt_BR']['CHARSET'] = 'iso-8859-1';
5c920668 922$languages['pt']['ALIAS'] = 'pt_PT';
a2a7852b 923
5c920668 924$languages['ru_RU']['NAME'] = 'Russian';
925$languages['ru_RU']['CHARSET'] = 'koi8-r';
926$languages['ru']['ALIAS'] = 'ru_RU';
a2a7852b 927
dbec0d67 928$languages['sr_YU']['NAME'] = 'Serbian';
929$languages['sr_YU']['CHARSET'] = 'iso-8859-2';
930$languages['sr']['ALIAS'] = 'sr_YU';
a2a7852b 931
5c920668 932$languages['sv_SE']['NAME'] = 'Swedish';
933$languages['sv_SE']['CHARSET'] = 'iso-8859-1';
934$languages['sv']['ALIAS'] = 'sv_SE';
a2a7852b 935
5c920668 936$languages['tr_TR']['NAME'] = 'Turkish';
937$languages['tr_TR']['CHARSET'] = 'iso-8859-9';
938$languages['tr']['ALIAS'] = 'tr_TR';
a2a7852b 939
5c920668 940$languages['zh_TW']['NAME'] = 'Taiwan';
941$languages['zh_TW']['CHARSET'] = 'big5';
942$languages['tw']['ALIAS'] = 'zh_TW';
a2a7852b 943
8ba79a3b 944$languages['zh_TW']['NAME'] = 'Chinese';
945$languages['zh_TW']['CHARSET'] = 'gb2312';
946$languages['tw']['ALIAS'] = 'zh_CN';
947
a2a7852b 948$languages['sk_SK']['NAME'] = 'Slovak';
949$languages['sk_SK']['CHARSET'] = 'iso-8859-2';
950$languages['sk']['ALIAS'] = 'sk_SK';
951
5c920668 952$languages['ro_RO']['NAME'] = 'Romanian';
953$languages['ro_RO']['CHARSET'] = 'iso-8859-2';
954$languages['ro']['ALIAS'] = 'ro_RO';
a2a7852b 955
5c920668 956$languages['th_TH']['NAME'] = 'Thai';
957$languages['th_TH']['CHARSET'] = 'tis-620';
958$languages['th']['ALIAS'] = 'th_TH';
a2a7852b 959
5c920668 960$languages['lt_LT']['NAME'] = 'Lithuanian';
961$languages['lt_LT']['CHARSET'] = 'iso-8859-13';
962$languages['lt']['ALIAS'] = 'lt_LT';
a2a7852b 963
5c920668 964$languages['sl_SI']['NAME'] = 'Slovenian';
965$languages['sl_SI']['CHARSET'] = 'iso-8859-2';
966$languages['sl']['ALIAS'] = 'sl_SI';
a2a7852b 967
5c920668 968$languages['bg_BG']['NAME'] = 'Bulgarian';
969$languages['bg_BG']['CHARSET'] = 'windows-1251';
970$languages['bg']['ALIAS'] = 'bg_BG';
a2a7852b 971
d3b57948 972// Right to left languages
973
974$languages['he_HE']['NAME'] = 'Hebrew';
975$languages['he_HE']['CHARSET'] = 'windows-1255';
976$languages['he_HE']['DIR'] = 'rtl';
977$languages['he']['ALIAS'] = 'he_HE';
978
979
5c920668 980/* Detect whether gettext is installed. */
a2a7852b 981$gettext_flags = 0;
982if (function_exists('_')) {
983 $gettext_flags += 1;
984}
985if (function_exists('bindtextdomain')) {
986 $gettext_flags += 2;
987}
988if (function_exists('textdomain')) {
989 $gettext_flags += 4;
990}
991
5c920668 992/* If gettext is fully loaded, cool */
a2a7852b 993if ($gettext_flags == 7) {
994 $use_gettext = true;
995}
5c920668 996/* If we can fake gettext, try that */
a2a7852b 997elseif ($gettext_flags == 0) {
998 $use_gettext = true;
999 include_once('../functions/gettext.php');
1000} else {
5c920668 1001 /* Uh-ho. A weird install */
a2a7852b 1002 if (! $gettext_flags & 1) {
1003 function _($str) {
1004 return $str;
1005 }
1006 }
1007 if (! $gettext_flags & 2) {
1008 function bindtextdomain() {
1009 return;
1010 }
1011 }
1012 if (! $gettext_flags & 4) {
1013 function textdomain() {
1014 return;
1015 }
1016 }
1017}
1018
b8b4ac4a 1019?>