File: language.class

package info (click to toggle)
myphpmoney 1.3RC3-13
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 4,160 kB
  • ctags: 884
  • sloc: php: 18,081; pascal: 2,106; sh: 327; xml: 239; makefile: 137; sql: 130
file content (728 lines) | stat: -rw-r--r-- 38,257 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
<?php
/**
 * $Id: language.class,v 1.10 2003/03/26 08:31:37 courou Exp $
 *
 * Author     : courou&#64;users.sourceforge.net
 * Website    : http://allreponse.ath.cx
 *
 * Support    : http://sourceforge.net/projects/myphpmoney/
 * CVS        : http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/myphpmoney/
 */

 // class qui permet de rechercher la langue
 // du browser de notre visiteur et d'inclure le bon fichier
 // de langue ou le fichier par default si celui ci est absent
 //
 // Mais aussi d'obtenir les memes informations en fournissent le code
 // pays , vous serez automatiquement dans votre nouvelle langue
 //
 // Cette class fonctionnent avec au moins un fichier
 // permettant ainsi d'avoir une possibilite d'extension de langue
 // sans avoir  tout redevelopper plus tard
 //
 // Ne necessite pas de base de donne
 // fonctionne avec php 4.0.0 minimal
 // non tester sous php 3
 // @autor    courou [courou&#64;users.sourceforge.net]
 // @date      12/06/2002
 // @Modified  29/11/2002
   class Languages {

        // The file where the class or extends is call
        var $file_settings                     = '';

        // Directory of language (ADD SLASH END)
        var $repertory_languages               = '';

        // Name of default file
        var $default_file_include              = '';

        // RETURN ID LANGUE | FILE INCLUDE | COUNTRY
        var $available_spoken;

        // RETURN THE LANGUAGE VALUES
        var $available_languages;

        // RETURN HTTP_ACCEPT_LANGUAGE
        var $accepted_languages;

        // RETURN THE COUNTRY VALUES FOR BROWSER
        var $detected_browser_country;

        // RETURN THE LANGUAGE VALUES FOR BROWSER
        var $detected_browser_languages;

        // ID DEFAULT COUNTRY (NUMBER 1 TO 231)
        var $default_id_Countries;

        // ID DEFAULT LANGUAGE (NUMBER 1 TO 52)
        var $default_id_lang;


     // Initisalisation de la class
     function Languages() {
      $this->Browser_Languages();
     }


     // Initisalisation all correspondance country - language
     // Order is :
     // the field[0] for the  id language
     // the field[1] for the file of lang available
     // the field[2] for the id pays spoken same language
     // @result the available_spoken
     function Initialisation() {
        $this->available_spoken =  array (
                          0      => array('1','albanish.inc.php','3','iso-8859-1','sq'),
                          1      => array('2','arabic.inc.php','11,1,4,228,216,203,196,197,182,174,159,137,139,125,121,116,19,58,60,62,66,108,127','iso-8859-6','ar'),
                          2      => array('3','armenian.inc.php','13','armscii-8','hy'),
                          3      => array('4','bengali.inc.php','20,106,150','euc-jp','bn'),
                          4      => array('6','brazilian.inc.php','31','iso-8859-1','pt-br'),
                          5      => array('7','bulgarian.inc.php','33','iso-8859-5','bg'),
                          6      => array('8','chinese_big5.inc.php','205','big5','zh-tw'),
                          7      => array('9','chinese_gb.inc.php','43,36,93,131,194','gb2312','zh'),
                          8      => array('11','croatian.inc.php','52','iso-8859-2','hr'),
                          9      => array('12','czech.inc.php','67','iso-8859-2','cs'),
                         10      => array('13','danish.inc.php','54,71,83','iso-8859-1','da'),
                         11      => array('14','divehi.inc.php','135','gb2312','div'),
                         12      => array('15','english.inc.php','65,28,21,25,2,8,9,15,18,23,89,85,70,72,30,55,57,76,78,79,80,81,98,99,95,96,126,120,114,118,110,103,104,105,100,101,146,148,149,158,162,153,154,155,168,169,219,38,122,123,134,142,40,202,213,214,215,193,183,185,186,187,188,189,198,164,230,231,223,206,209,233,234,236,237','iso-8859-1','en'),
                         13      => array('16','estonian.inc.php','64','iso-8859-1','et'),
                         14      => array('17','farsi.inc.php','109','iso-8859-6','fa'),
                         15      => array('18','finnish.inc.php','73','iso-8859-1','fi'),
                         16      => array('19','french.inc.php','74,51,221,34,35,6,22,24,229,212,207,208,200,191,192,184,181,171,157,152,138,140,87,88,56,41,37,46,47,84,90,91,144,227,178,75,132,232','iso-8859-1','fr'),
                         17      => array('20','german.inc.php','5,16,130,128','iso-8859-1','de'),
                         18      => array('21','greek.inc.php','82','iso-8859-7','el'),
                         19      => array('22','hebrew.inc.php','112','iso-8859-8-i','he'),
                         20      => array('23','hungarian.inc.php','94','iso-8859-2','hu'),
                         21      => array('24','indonesian.inc.php','107,26','iso-8859-1','id'),
                         22      => array('25','islandish.inc.php','111','iso-8859-1','is'),
                         23      => array('26','italian.inc.php','113,190,224','iso-8859-1','it'),
                         24      => array('27','japanese.inc.php','115','shift-jis','ja'),
                         25      => array('29','korean.inc.php','48,49','ks_c_5601-1987','ko'),
                         26      => array('31','latvian.inc.php','124','iso-8859-4','lv'),
                         27      => array('32','lithuanian.inc.php','129','iso-8859-4','lt'),
                         28      => array('33','macedonian.inc.php','175','iso-8859-5','mk'),
                         29      => array('34','malaysian.inc.php','133,32,235','iso-8859-1','ms'),
                         30      => array('35','maltesian.inc.php','136','iso-8859-3','mt'),
                         31      => array('36','mongolian.inc.php','145','shift-jis','mn'),
                         32      => array('37','dutch.inc.php','166,10,14,201','iso-8859-1','nl'),
                         33      => array('38','norwegian.inc.php','156,97,102','iso-8859-1','no'),
                         34      => array('39','ourdou.inc.php','161','iso-8859-6','ur'),
                         35      => array('40','polish.inc.php','170','iso-8859-2','pl'),
                         36      => array('41','portuguese.inc.php','173,7,39,147,211','iso-8859-1','pt'),
                         37      => array('42','romanian.inc.php','179','iso-8859-1','ro'),
                         38      => array('43','moldave.inc.php','143','koi8-r','ru-koi8r'),
                         39      => array('44','russian.inc.php','180,27,77,68,117,119,204,217,160','windows-1251','ru-win1251'),
                         40      => array('45','serbian.inc.php','69','iso-8859-2','sr'),
                         41      => array('46','slovak.inc.php','177,195','iso-8859-2','sk'),
                         42      => array('47','spanish.inc.php','63,172,222,165,163,176,167,53,29,42,50,59,61,86,92,45,151,225,12,141','iso-8859-1','es'),
                         43      => array('48','swedish.inc.php','199','iso-8859-1','sv'),
                         44      => array('49','thai.inc.php','210','tis-620','th'),
                         45      => array('50','turkish.inc.php','218,17,44','iso-8859-9','tr'),
                         46      => array('51','ukrainian.inc.php','220','iso-8859-5','uk'),
                         47      => array('52','vietnamese.inc.php','226','windows-1252','vi')
        );
     return $this->available_spoken;
     }

     // Initisalisation browser country code
     // Order is :
     // the field[0] for the id country
     // the field[1] for the id language
     // @result the available_languages
       function Browser_Languages() {
          $this->available_languages = array(
                                'aa'      => array(  0,    0), ## afar
                                'ab'      => array(  0,    0), ## abkhazian
                                'ae'      => array(  0,    0), ## avestan
                                'af'      => array(  2,   15),
                                'am'      => array(  0,    0), ## amharic
                                'ar'      => array( 11,    2),
                                'ar-ae'   => array( 60,    2),
                                'ar-bh'   => array( 19,    2),
                                'ar-eg'   => array( 58,    2),
                                'ar-dz'   => array( 4,     2),
                                'ar-iq'   => array( 108,   2),
                                'ar-jo'   => array( 116,   2),
                                'ar-qa'   => array( 174,   2),
                                'ar-kw'   => array( 121,   2),
                                'ar-lb'   => array( 125,   2),
                                'ar-ly'   => array( 127,   2),
                                'ar-ma'   => array( 137,   2),
                                'ar-om'   => array( 159,   2),
                                'ar-sa'   => array( 11,    2),
                                'ar-sy'   => array( 203,   2),
                                'ar-tn'   => array( 216,   2),
                                'ar-ye'   => array( 228,   2),
                                'as'      => array( 0,     0), ## asie assamais
                                'ay'      => array( 0,     0), ## aymara
                                'az'      => array( 17,   50),
                                'ba'      => array( 0,     0), ## bashkir
                                'be'      => array( 27,   44),
                                'bh'      => array(  0,    0), ## bihari
                                'bg'      => array( 33,    7),
                                'bi'      => array(  0,    0), ## bislama
                                'bn'      => array( 20,    4),
                                'bo'      => array(  0,    0), ## tibet
                                'bs'      => array(  0,    0), ## bosnian
                                'br'      => array( 74,   19),
                                'ca'      => array(  6,   19),
                                'ce'      => array(  0,    0), ## chechen
                                'ch'      => array(  0,    0), ## chamorro
                                'co'      => array( 74,   19),
                                'cs'      => array( 67,   12),
                                'cu'      => array(  0,    0), ## church slavic
                                'cv'      => array(  0,    0), ## chuvash
                                'cy'      => array(  0,    0), ## welsh
                                'da'      => array( 54,   13),
                                'de'      => array(  5,   20),
                                'de-at'   => array( 16,   20),
                                'de-ch'   => array( 200,  20),
                                'de-li'   => array( 128,  20),
                                'de-lu'   => array( 130,  20),
                                'div'     => array( 135,  14),
                                'dz'      => array( 26,   24),
                                'el'      => array( 77,   44),
                                'en'      => array( 80,   15),
                                'en-au'   => array( 15,   15),
                                'en-ca'   => array( 38,   15),
                                'en-gb'   => array( 80,   15),
                                'en-ie'   => array( 110,  15),
                                'en-ph'   => array( 168,  15),
                                'en-jm'   => array( 114,  15),
                                'en-nz'   => array( 158,  15),
                                'en-tt'   => array( 215,  15),
                                'en-us'   => array( 65,   15),
                                'en-za'   => array( 2,    15),
                                'en-zw'   => array( 231,  15),
                                'eo'      => array(  0,    0), ## esperantos
                                'es'      => array( 63,   47),
                                'es-ar'   => array( 12,   47),
                                'es-bo'   => array( 29,   47),
                                'es-us'   => array( 65,   47),
                                'es-co'   => array( 45,   47),
                                'es-cl'   => array( 42,   47),
                                'es-cr'   => array( 50,   47),
                                'es-do'   => array( 176,  47),
                                'es-ec'   => array( 61,   47),
                                'es-gt'   => array( 86,   47),
                                'es-hn'   => array( 92,   47),
                                'es-mx'   => array( 141,  47),
                                'es-ni'   => array( 151,  47),
                                'es-pa'   => array( 163,  47),
                                'es-pe'   => array( 167,  47),
                                'es-pr'   => array( 172,  47),
                                'es-py'   => array( 165,  47),
                                'es-sv'   => array( 0,     0), ## salvador
                                'es-uy'   => array( 222,  47),
                                'es-ve'   => array( 225,  47),
                                'et'      => array( 64,   16),
                                'eu'      => array( 74,   19),
                                'fa'      => array( 109,  17),
                                'fi'      => array( 73,   18),
                                'fo'      => array( 71,   13),
                                'fr'      => array( 74,   19),
                                'fr-fr'   => array( 74,   19), ## fr mozilla
                                'fr-be'   => array( 22,   19),
                                'fr-ca'   => array( 38,   19),
                                'fr-ch'   => array( 200,  19),
                                'fr-lu'   => array( 130,  19),
                                'fr-mc'   => array( 144,  19),
                                'fy'      => array( 0,     0), ## frisian
                                'gd'      => array( 0,     0), ## galique
                                'gq'      => array( 232,  19), ## Guine
                                'gl'      => array( 0,     0), ## galicien
                                'gv'      => array( 0,     0), ## manx gaelic
                                'gu'      => array( 82,   21),
                                'gs'      => array( 233,  15), ## Iles Gorgie
                                'ha'      => array( 0,     0), ## hausa
                                'he'      => array( 112,  22),
                                'hi'      => array( 0,     0), ## hindi
                                'ho'      => array( 0,     0), ## hiri motu
                                'hr'      => array( 52,   11),
                                'hu'      => array( 94,   23),
                                'hy'      => array( 13,   3),
                                'ia'      => array( 0,     0), ## interlingua
                                'ie'      => array( 0,     0), ## interlingue
                                'id'      => array( 107,  24),
                                'ik'      => array( 0,     0), ## inupiak
                                'is'      => array( 111,  25),
                                'it'      => array( 113,  26),
                                'it-ch'   => array( 200,  26),
                                'iu'      => array( 0,     0), ## inuktitut
                                'ja'      => array( 115,  27),
                                'jw'      => array( 0,     0), ## javanese
                                'ka'      => array( 0,     0), ## georgien
                                'kk'      => array( 117,  44),
                                'kl'      => array( 83,   13),
                                'km'      => array( 36,    9),
                                'kn'      => array( 0,     0), ## kannada
                                'ko'      => array( 48,   29),
                                'kok'     => array( 0,     0), ## konkani
                                'ku'      => array( 0,     0), ## kurdish
                                'ks'      => array( 0,     0), ## kashmiri
                                'kv'      => array( 0,     0), ## komi
                                'kw'      => array( 0,     0), ## Cornish
                                'ky'      => array( 0,     0), ## kirghiz
                                'kz'      => array( 0,     0), ## herero
                                'la'      => array( 74,   19),
                                'lb'      => array( 130,  20),
                                'lt'      => array( 129,  32),
                                'ln'      => array( 0,     0), ## lingala
                                'lv'      => array( 124,  31),
                                'mh'      => array( 0,     0), ## marshall
                                'mi'      => array( 0,     0), ## maori
                                'mg'      => array( 0,     0), ## malagasy
                                'mh'      => array( 234,  15), ## les Marshall
                                'mk'      => array( 175,  33),
                                'ml'      => array( 235,  34), ## mali
                                'mn'      => array( 145,  36),
                                'mp'      => array( 236,  15), ## Mariannes du Nord
                                'mo'      => array( 143,  43),
                                'mr'      => array( 0,     0), ## marathi
                                'ms'      => array( 32,   34),
                                'mt'      => array( 136,  35),
                                'my'      => array( 133,  34), ## malaisie
                                'na'      => array( 149,  15),
                                'nb'      => array( 156,  38),
                                'nb-no'   => array( 156,  38),
                                'ne'      => array( 106,   4),
                                'nl'      => array( 166,  37),
                                'nl-be'   => array( 22,   37),
                                'nn'      => array( 156,  38),
                                'nn-no'   => array( 156,  38),
                                'no'      => array( 156,  38),
                                'no-nyn'  => array( 156,  38),
                                'nv'      => array( 0,     0), ## navajo
                                'oc'      => array( 0,     0), ## occitan
                                'or'      => array( 0,     0), ## oriya
                                'om'      => array( 0,     0), ## oromo - afan
                                'os'      => array( 0,     0), ## ossetic
                                'pa'      => array( 0,     0), ## penjabi
                                'pi'      => array( 0,     0), ## pali
                                'pl'      => array( 170,  40),
                                'pt'      => array( 173,  41),
                                'pt-br'   => array( 31,    6),
                                'ps'      => array( 0,     0), ## pushto
                                'qu'      => array( 0,     0), ## quechua
                                'rm'      => array( 0,     0), ## rheto roman
                                'rn'      => array( 0,     0), ## kirundi
                                'ro'      => array( 179,  42),
                                'ro-md'   => array( 143,  43),
                                'ru'      => array( 180,  44),
                                'ru-md'   => array( 143,  43),
                                'rw'      => array( 0,     0), ## kinyarwanda
                                'sa'      => array( 0,     0), ## sanscrit
                                'sb'      => array( 0,     0), ## sorabe
                                'sc'      => array( 0,     0), ## sardinian
                                'sd'      => array( 0,     0), ## sindhi
                                'se'      => array( 0,     0), ## sami
                                'sg'      => array( 0,     0), ## sangro
                                'si'      => array( 198,  15),
                                'sk'      => array( 195,  46),
                                'sl'      => array( 195,  46),
                                'sm'      => array( 188,  15),
                                'sn'      => array( 0,     0), ## shona
                                'so'      => array( 196,   2),
                                'sq'      => array( 3,     1),
                                'sr'      => array( 69,   45),
                                'ss'      => array( 0,     0), ## siswati
                                'st'      => array( 237,  15), ## Sao Tom-et-Principe
                                'su'      => array( 0,     0), ## sundanese
                                'sv'      => array( 199,  48),
                                'sv-fi'   => array( 73,   18),
                                'sw'      => array( 0,     0), ## swahili
                                'sx'      => array( 0,     0), ## sutu
                                'syr'     => array( 203,   2),
                                'ta'      => array( 0,     0), ## tamoul
                                'te'      => array( 0,     0), ## telougou
                                'tl'      => array( 0,     0), ## tagalog
                                'tg'      => array( 0,     0), ## tajik
                                'th'      => array( 210,  49),
                                'ti'      => array( 0,     0), ## tigrinyna
                                'tk'      => array( 217,  44),
                                'tn'      => array( 0,     0), ## tswana
                                'to'      => array( 214,  15),
                                'tr'      => array( 218,  50),
                                'ts'      => array( 214,  15),
                                'tt'      => array( 0,     0), ## tatar
                                'tw'      => array( 0,     0), ## twi
                                'uk'      => array( 220,  51),
                                'ur'      => array( 161,  39),
                                'uz'      => array( 160,  44),
                                'vi'      => array( 226,  52),
                                'vo'      => array( 0,     0), ## volapuk
                                'wo'      => array( 0,     0), ## wolof
                                'xh'      => array( 0,     0), ## xhosa
                                'yi'      => array( 0,     0), ## yiddish
                                'zh'      => array( 43,    9),
                                'zh-cn'   => array( 43,    9),
                                'zh-hk'   => array( 43,    9),
                                'zh-mo'   => array( 93,    9),
                                'zh_sg'   => array( 194,   9),
                                'zh_tw'   => array( 205,   8),
                                'za'      => array( 0,     0), ## zhuang
                                'zu'      => array( 0,     0)  ## zoulou
            );
        $this->accepted_languages = explode(',', getenv('HTTP_ACCEPT_LANGUAGE'));
        $this->Scan_Languages();
        $this->distribution = explode('|', $this->Get_Distribution());
        $this->detected_browser_country   = isset($this->distribution[0]) ? $this->distribution[0] : $this->default_id_Countries;
        $this->detected_browser_languages = isset($this->distribution[1]) ? $this->distribution[1] : $this->default_id_lang;
        }


     // Verified : default language - default id lang - default id country
     // @result $this->default_file_include
     // @result $this->default_id_Countries
     // @result $this->default_id_lang
       function Scan_Languages() {

         if (sizeof($this->Get_List_Lang(1)) > 0) {

                foreach($this->Get_List_Lang(1) as $scann) {
                  $scann = explode("|",$scann);
                     $file_lang[] = $scann[0];
                     $id_lang[]   = $scann[1];
                }
                ## The default lang is empty or don't exist
                if (!isset($this->default_file_include) || $this->default_file_include == '') {
                     $this->default_file_include = $file_lang[0];
                     $this->default_id_Countries = $this->Default_Country($id_lang[0]);
                     $this->default_id_lang      = $id_lang[0];

                }
                ## The default lang is good and exist
                else if (in_array($this->default_file_include,$file_lang)) {
                  $key = array_search($this->default_file_include,$file_lang);

                     $this->default_file_include = $this->default_file_include;
                     $this->default_id_Countries = $this->Default_Country($id_lang[$key]);
                     $this->default_id_lang      = $id_lang[$key];
                }
                else {
                ## The default lang don't exist - take the first lang exist
                     $this->default_file_include = $file_lang[0];
                     $this->default_id_Countries = $this->Default_Country($id_lang[0]);
                     $this->default_id_lang      = $id_lang[0];
                }

         } else {

              if (!isset($this->repertory_languages) || $this->repertory_languages == '') {
               $msg  = sprintf("Dir %s is Empty or Dir does not exist ?",basename($this->repertory_languages));
               $msg .= sprintf("<br />Check the value of \$_MPM['dir_lang'] in the %s file<br />\n",basename($this->file_settings));
               $this->halt($msg);
              }
              if (!isset($this->default_file_include) || $this->default_file_include == '') {
               $msg  = sprintf("Default File %s is Empty or Default File does not exist ?",$this->default_file_include);
               $msg .= sprintf("<br />Check the value of \$_MPM['file_lang'] in the %s file<br />\n",basename($this->file_settings));
               $this->halt($msg);
              }
              if (!file_exists($this->repertory_languages."".$this->default_file_include)) {
               $msg  = sprintf("Language file '%s' not found !",$this->default_file_include);
               $msg .= sprintf("<br />Check in your \$_MPM['dir_lang'] directory, you need at *least* one language file ..<br />\n",$this->default_file_include);
               $this->halt($msg);
              }

         }
   } ## end of function Scan_Languages

     // send the code pays and code lang
     // @result detected_browser_country
     // @result detected_browser_languages
        function Get_Distribution() {
               if (empty($this->detected_browser_country)) {
                $this->detected_browser_country = $this->default_id_Countries; // DEFAULT LANGUAGE ENGLISH
                $cnt = 0;

                while ($cnt < sizeof($this->accepted_languages)) {
                  reset($this->available_languages);

                  while (list($key, $value) = each($this->available_languages)) {
                        if ($key == $this->accepted_languages[$cnt]) {
                                if ($value[0] == 0) $value[0] = $this->default_id_Countries; // DEFAULT COUNTRY U.S.A
                                if ($value[1] == 0) $value[1] = $this->default_id_lang;      // DEFAULT LANG ENGLISH
                        $this->detected_browser_country = $value[0].'|'.$value[1];           // NAME OF FILE
                        break 2;
                        }
                  }
                  $cnt++;
                }
          }
          return $this->detected_browser_country;
        } ## end of function Verif_Country_Browser()


      // retourn the default country
      // @param $lang = id of language
        function Default_Country($lang) {
          $this->arg = $this->Initialisation();
             foreach ($this->arg as $this->files) {
                  if ($lang == $this->files[0]) {
                  $begin = explode(',',$this->files[2]);
                        return $begin[0];
                  }
             }
        }


      // retourn the iso or language
      // @param $lang = id of language
      // @param $choice = 1 for the charset
      // @param $choice = 2 for the language
        function Charset_need($lang,$choice='') {
          $this->arg = $this->Initialisation();
             foreach ($this->arg as $this->files) {
                  if ($lang == $this->files[0]) {
                        if ($choice == 1) return $this->files[3];
                        if ($choice == 2) return $this->files[4];
                  }
             }
        }


     // return the list of language file et this id
        function Get_List_file() {
          Global $_VAR;
         $this->arg = $this->Initialisation();
                foreach ($this->arg as $files) {
                 $tab_files[] = $_VAR["THIS_LANG"][$files[0]]."|$files[1]|$files[0]";
                }
        array_multisort($tab_files,SORT_STRING,SORT_ASC);
        return $tab_files;
        }


      // return a specical list
      // @param $choice  = choice for the list
      // choice == 1 all valide lang and present
      // choice == 2 list of possible add
        function Get_List_Lang($choice='') {
         Global $_MPM;
         $lang_exist = array();
         $lang_no_exist = array();

    if (is_array($this->Get_List_file())) {
               foreach($this->Get_List_file() as $f) {
                 $f = explode('|',$f);
                    if (file_exists($_MPM['dir_lang']."$f[1]")) {
                       $lang_exist[] .= $f[1].'|'.$f[2];
                    } else {
                       $lang_no_exist[] .= $f[1].'|'.$f[2];
                    }
               }
            if (($choice == 1 && is_array($lang_exist))) return $lang_exist;
            else if (($choice == 2 && is_array($lang_exist))) return $lang_no_exist;
            else return false;
          } ## end of is_array
      }


     // Verified if country exist in the array
     // @param $Countries = l'id rechercher
     // @param $field     = compared field
     // @result list of valide coutry
     function Return_Countries($Countries) {
      $L = array();
              foreach ($this->Initialisation() as $value) {
                 $tab = explode(',',$value[2]); asort($tab);
                     foreach ($tab as $new_cle => $new_value) {
                       if ($Countries == $new_value) $L[] = $value[0].','.$new_value;
                     } ## end of foreach ($tab as $new_cle => $new_value)
              if (!is_array($L)) $L[] = 'null,null';
           } ## end of foreach ($id_lang as $value)
      return $L;
     } ## end of Return_Countries


     // Pre recherche de tous les champs
     // @param $Countries = id of country
     // @result tri the country and send
     function Get_Tri($Countries,$order) {
        $search = $this->Return_Countries($Countries);
           foreach ($search as $h) {
                $hl = explode(',',$h);
            }
        if (isset($hl)) {
           if ($order == 1) { if ($hl[0] == 'null') return $this->default_id_Countries; else return $hl[1]; }
           if ($order == 2) { if ($hl[0] == 'null') return $this->default_id_lang;      else return $hl[0]; }
        } else {
           if ($order == 1) return $this->default_id_Countries;
           if ($order == 2) return $this->default_id_lang;
        }
     } ## end of Get_Tri()



     // Verified if country exist in the array
     // @param $Countries = l'id rechercher
     // @param $field     = compared field
     // @result tri the country and send
     function Get_Tri_after($Countries,$orders) {
         $this->langs = $this->Initialisation();
              foreach ($this->langs as $values) {
              if ($orders == 1) { if ($Countries == $values[0]) return $values[1]; }
              if ($orders == 2) { if ($Countries == $values[0]) return $values[0]; }
           }
     } ## end of Return_Countries


     // verified and return the id of country
     // @param $Countries = id of country
     // @result get the country id
     function Get_Country($Countries) {
        if (!isset($Countries)) $Countries = $this->detected_browser_country;
     return $this->Get_Tri($Countries,1);
     } ## end of Get_Country()


     // verified and return the id of language
     // @param $Countries = id of country
     // @result get the language id
     function Get_Lang($Countries) {
        if (!isset($Countries)) $this->Countries = $this->Get_Country($this->detected_browser_country);
     return $this->Get_Tri($Countries,2);
     } ## end of Get_Lang()



     // Translate the country
     // @param $Countries = id of country
     // @result translate the name of country
     function Translate_Country($Countries) {
       Global $_VAR;
       $this->idx = $this->Get_Country($Countries);
          if (isset($this->idx)) return $_VAR['THIS_COUNTRY'][$this->idx]['COUNTRY'];
     } ## end of Translate_Country()



     // Translate the money
     // @param $Countries = id of country
     // @result translate the name of money
     function Translate_Money($Countries) {
       Global $_VAR;
       $this->idx = $this->Get_Country($Countries);
          if (isset($this->idx)) return $_VAR['THIS_COUNTRY'][$this->idx]['MONEY'];
     } ## end of Translate_Money()


     // Translate the lang
     // @param $lang = id of language
     // @result the name of language
     function Translate_Lang($lang) {
       Global $_VAR;
        $this->idx = $this->Get_Tri_after($lang,2);
        if (isset($this->idx)) return $_VAR['THIS_LANG'][$this->idx];
     } ## end of Translate_Lang()


     // return simple the name (no verif)
     // @param $lang = id of language
     // @result give the name of file for include
     function Get_File($lang) {
          return $this->Get_Tri_after($lang,1);
     } ## end of Get_File()


     // verif the existing file
     // @param $lang = id of language
     // @param $Countries = id of country
     // @result give the name of file for include
     function Get_File_Verif($lang,$Countries) {
     $f_lang = $this->Get_Tri_after($lang,1);
     $lang_c = $this->Get_tri($Countries,2);
     $fc_lang = $this->Get_File($lang_c);
         if (file_exists($this->repertory_languages."".$f_lang)) {
            return $lang;
         } else if (file_exists($this->repertory_languages."".$fc_lang)) {
            return $lang_c;
         } else {
            return $this->default_id_lang;
         }
     } ## end of Get_File()


     // Include the language file
     // @param $lang = id of language
     // @param $Countries = id of country
     // @result include the default language or language
     // the Global is necessary for the individual file lang
     function Include_File($lang,$Countries) {
       Global $_VAR;
       $file_name = $this->Get_File($lang);
       $individual_lang = $this->Get_tri($Countries,2);
       $file_individual = $this->Get_File($individual_lang);

         if ($file_name == "") {
               require_once $this->repertory_languages."".$this->default_file_include;
         }
         else if (file_exists($this->repertory_languages."".$file_name)) {
               require_once $this->repertory_languages."".$file_name;
         }
         else if (file_exists($this->repertory_languages."".$file_individual)) {
               require_once $this->repertory_languages."".$file_individual;
         }
         else {
               require_once $this->repertory_languages."".$this->default_file_include;
         }
     } ## end of Include_File()


     // private: error handling
     // @result $mess
     function halt($msg) {
       $this->haltmsg($msg);
       die("Session halted.");
     }


     // private: error handling
     // @result $mess
     function haltmsg($msg) {
       printf("Language error: <br /><br /><span class=\"menubold\"> %s </span><br />\n", $msg);
     }

} ## end of class Find_Languages()

     // Comment utiliser la class
     // ---pour instancier
     // $lg = new Languages;
     // ---les methodes :
     // - recherche de id coutry et de id language du browser
     // $id_country             = $lg->detected_browser_country;
     // $id_language            = $lg->detected_browser_languages;
     // - recherche de id coutry et de id language d'un id
     // $id_country             = $lg->Get_Country(231);
     // $id_language            = $lg->Get_Lang($id_country);
     // - inclure le fichier de langue
     // $include_file           = $lg->Include_File($id_language,$id_country);
     // - le nom du fichier de langue
     // $name_file              = $lg->Get_File($id_language);
     // - verif the existing file name
     // $verif_name_file        = $lg->Get_File_Verif($id_language,$id_country);
     // - verif the existing file name
     // $verif_name_file        = $lg->Get_File_Verif($id_language,$id_country);
     // - return the charset
     // $charset_field         = $lg->Charset_need($verif_field,1);
     // - return the code language (iso)
     // $language_field        = $lg->Charset_need($verif_field,2);
     // - recherche le premier pays de la langue
     // $language_field        = $lg->Default_Country($id_language);
     // - la traduction du nom de la langue
     // $lang_name              = $lg->Translate_Lang($verif_name_file);
     // - la traduction du nom du pays
     // $name_country           = $lg->Translate_Country($id_country);
     // - la traduction de la monnaie du nom du pays
     // $money_country          = $lg->Translate_Money($id_country);
     // ---obtenir la liste des fichiers langues
     // $tab_file               = $lg->Get_List_file()
     // ---verif idividuel :
     // $individual_field       = $lg->Get_tri($id_country,1);
     // $individual_field       = $lg->Get_tri($id_country,2);
     //
     // function usage_utility() just for phpdoc
     function usage_utility() {
        while(1){};
     }