source: branches/comu-utf8/data/conf/i18n.php @ 15109

Revision 15109, 861 bytes checked in by Yammy, 14 years ago (diff)

国際化用ファイル追加

Line 
1<?php
2
3// ‘Û‰»—p
4define('LOCALE_DIR', DATA_PATH . 'locale/');
5
6$accept_language = '';
7if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
8    $accept_language = array_shift(split(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']));
9}
10switch ($accept_language) {
11case 'ja':
12    $language = 'ja';
13    break;
14case 'ko':
15case 'ko-kr':
16    $language = 'ko';
17    break;
18case 'en':
19case 'en-us':
20    $language = 'en';
21    break;
22default:
23    $language = 'C';
24    break;
25}
26$text = file_get_contents(LOCALE_DIR . $language . '.html');
27$preVar = explode('<!--end-->', $text);
28foreach ($preVar AS $preVar_1) {
29    $preVar_2 = explode('-->', $preVar_1);
30    $preVar_3 = explode('<!--', $preVar_2[0]);
31    $newVar = str_replace('', '_', $preVar_3[1]);
32    #$_GLOBALS['_lang'][$newVar] = $preVar_2[1];
33    define('_lang_' . $newVar, $preVar_2[1]);
34}
35#var_dump($accept_language);
36#var_dump($language);
37
38?>
Note: See TracBrowser for help on using the repository browser.