Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
 
3
require_once 'System.php';
4
require_once 'File/Gettext.php';
5
require_once 'I18Nv2/Locale.php';
6
 
7
$l = &new I18Nv2_Locale('en');
8
 
9
foreach (array('mo', 'po') as $fileType) {
10
 
11
    $g = &File_Gettext::factory($fileType);
12
    $g->meta = array('Content-Type' => 'text/plain; charset=iso-8859-1');
13
 
14
    // =============================================================================
15
 
16
    $langs = array('en', 'de', 'it');
17
    foreach ($langs as $lang) {
18
        $l->setLocale($lang);
19
        $g->strings = array();
20
        foreach (range(0, 6) as $day) {
21
            $g->strings["day_$day"] = strtolower($l->dayName($day));
22
        }
23
        foreach (range(0, 11) as $month) {
24
            $g->strings[sprintf('month_%02d', $month + 1)] = strtolower($l->monthName($month));
25
        }
26
        if (!is_dir('locale')) {
27
            mkdir('locale');
28
        }
29
        if (!is_dir('locale/' . $lang)) {
30
            mkdir('locale/' . $lang);
31
        }
32
        $dir = 'locale/'. $lang .'/LC_MESSAGES/';
33
        if (!is_dir($dir)) {
34
            mkdir($dir);
35
            //System::mkdir(array('-p', $dir = 'locale/'. $lang .'/LC_MESSAGES/'));
36
        }
37
        $g->save($dir . 'calendar.'.$fileType);
38
    }
39
 
40
    $g->strings = array('alone' => 'solo soletto');
41
    $g->save('locale/it/LC_MESSAGES/alone.'.$fileType);
42
    $g->strings = array('alone' => 'all alone');
43
    $g->save('locale/en/LC_MESSAGES/alone.'.$fileType);
44
 
45
    // =============================================================================
46
 
47
    $g->strings = array('prova_conflitto' => 'testo con conflitto - in page');
48
    $g->save('locale/it/LC_MESSAGES/in_page.'.$fileType);
49
    $g->strings = array('prova_conflitto' => 'conflicting text - in page');
50
    $g->save('locale/en/LC_MESSAGES/in_page.'.$fileType);
51
 
52
    // =============================================================================
53
 
54
    $g->strings = array(
55
        'only_english'    => null,
56
        'only_italian'    => 'testo solo in italiano',
57
        'hello_user'      => 'ciao, &&user&&, oggi è il &&day&& &&month&& &&year&& (&&weekday&&)',
58
        'isempty'         => null,
59
        'prova_conflitto' => 'testo con conflitto - globale',
60
        'test'            => 'stringa di prova',
61
        'Entirely new string' => null,
62
    );
63
    $g->save('locale/it/LC_MESSAGES/messages.'.$fileType);
64
    $g->strings = array(
65
        'only_english'    => 'only english text',
66
        'only_italian'    => null,
67
        'hello_user'      => 'hello &&user&&, today is &&weekday&&, &&day&&th &&month&& &&year&&',
68
        'isempty'         => null,
69
        'prova_conflitto' => 'conflicting text - Global',
70
        'test'            => 'this is a test string',
71
        'Entirely new string' => 'Entirely new string',
72
    );
73
    $g->save('locale/en/LC_MESSAGES/messages.'.$fileType);
74
 
75
    $g->strings = array('isempty' => 'this string is empty in English and Italian, but not in German!');
76
    $g->save('locale/de/LC_MESSAGES/messages.'.$fileType);
77
 
78
    // =============================================================================
79
 
80
    $g->strings = array(
81
        'first string'  => 'first string',
82
        'second string' => 'second string',
83
    );
84
    $g->save('locale/en/LC_MESSAGES/small page.'.$fileType);
85
 
86
    $g->strings = array(
87
        'first string'  => 'prima stringa',
88
        'second string' => 'seconda stringa',
89
    );
90
    $g->save('locale/it/LC_MESSAGES/small page.'.$fileType);
91
 
92
    unset($g);
93
}
94
?>