Ticket #1374: 1374.2.patch

File 1374.2.patch, 7.8 KB (added by derek@…, 18 years ago)

Adds i18n support

Line 
1Index: languages/English.php
2===================================================================
3--- languages/English.php       (revision 9204)
4+++ languages/English.php       (working copy)
5@@ -179,6 +179,8 @@
6     'Sub and Desc (Empty matches)' => '',
7     'rectype: finddaily'           => 'Find One Daily',
8     'rectype: findweekly'          => 'Find One Weekly',
9+// includes/sorting.php
10+    '(A |An |The )'               => '',
11 // includes/utils.php
12     '$1 B'  => '',
13     '$1 GB' => '',
14Index: languages/Czech.php
15===================================================================
16--- languages/Czech.php (revision 9204)
17+++ languages/Czech.php (working copy)
18@@ -178,6 +178,8 @@
19     'Sub and Desc (Empty matches)' => '',
20     'rectype: finddaily'           => 'Find One Daily',
21     'rectype: findweekly'          => 'Find One Weekly',
22+// includes/sorting.php
23+    '(A |An |The )'                => '',
24 // includes/utils.php
25     '$1 B'  => '',
26     '$1 GB' => '',
27Index: languages/Finnish.php
28===================================================================
29--- languages/Finnish.php       (revision 9204)
30+++ languages/Finnish.php       (working copy)
31@@ -183,6 +183,8 @@
32     'Sub and Desc (Empty matches)' => 'Kuvaus ja Nimike (Ei vastaavuuksia)',
33     'rectype: finddaily'           => 'Etsi PÀivittÀinen',
34     'rectype: findweekly'          => 'Etsi Viikottainen',
35+// includes/sorting.php
36+    '(A |An |The )'                => '',
37 // includes/utils.php
38     '$1 B'  => '$1 B',
39     '$1 GB' => '$1 GB',
40Index: languages/Slovenian.php
41===================================================================
42--- languages/Slovenian.php     (revision 9204)
43+++ languages/Slovenian.php     (working copy)
44@@ -178,6 +178,8 @@
45     'Sub and Desc (Empty matches)' => 'Podnaslov in opis (prazni zadetki)',
46     'rectype: finddaily'           => 'Najdi dnevno',
47     'rectype: findweekly'          => 'Najdi tedensko',
48+// includes/sorting.php
49+    '(A |An |The )'                => '',
50 // includes/utils.php
51     '$1 B'  => '',
52     '$1 GB' => '',
53Index: languages/English_GB.php
54===================================================================
55--- languages/English_GB.php    (revision 9204)
56+++ languages/English_GB.php    (working copy)
57@@ -179,6 +179,8 @@
58     'Sub and Desc (Empty matches)' => '',
59     'rectype: finddaily'           => 'Find One Daily',
60     'rectype: findweekly'          => 'Find One Weekly',
61+// includes/sorting.php
62+    '(A |An |The )'                => '',
63 // includes/utils.php
64     '$1 B'  => '',
65     '$1 GB' => '',
66Index: languages/Australian.php
67===================================================================
68--- languages/Australian.php    (revision 9204)
69+++ languages/Australian.php    (working copy)
70@@ -179,6 +179,8 @@
71     'Sub and Desc (Empty matches)' => '',
72     'rectype: finddaily'           => '',
73     'rectype: findweekly'          => '',
74+// includes/sorting.php
75+    '(A |An |The )'                => '',
76 // includes/utils.php
77     '$1 B'  => '$1 shotglass',
78     '$1 GB' => '$1 stein',
79Index: languages/French.php
80===================================================================
81--- languages/French.php        (revision 9204)
82+++ languages/French.php        (working copy)
83@@ -178,6 +178,8 @@
84     'Sub and Desc (Empty matches)' => 'Sub et Desc (Vide correspond)',
85     'rectype: finddaily'           => 'Trouver aujourd\'hui',
86     'rectype: findweekly'          => 'trouver cette semaine',
87+// includes/sorting.php
88+    '(A |An |The )'                => '',
89 // includes/utils.php
90     '$1 B'  => '$1 B',
91     '$1 GB' => '$1 GB',
92Index: languages/Spanish.php
93===================================================================
94--- languages/Spanish.php       (revision 9204)
95+++ languages/Spanish.php       (working copy)
96@@ -178,6 +178,8 @@
97     'Sub and Desc (Empty matches)' => 'Sub y Desc (Coincidencias vacías)',
98     'rectype: finddaily'           => 'rectype: buscar diario',
99     'rectype: findweekly'          => 'rectype: buscar semanal',
100+// includes/sorting.php
101+    '(A |An |The )'                => '',
102 // includes/utils.php
103     '$1 B'  => '$1 B',
104     '$1 GB' => '$1 GB',
105Index: languages/Danish.php
106===================================================================
107--- languages/Danish.php        (revision 9204)
108+++ languages/Danish.php        (working copy)
109@@ -178,6 +178,8 @@
110     'Sub and Desc (Empty matches)' => 'Undertitel og beskrivelse',
111     'rectype: finddaily'           => 'find 1 dagligt',
112     'rectype: findweekly'          => 'find 1 ugentligt',
113+// includes/sorting.php
114+    '(A |An |The )'                => '',
115 // includes/utils.php
116     '$1 B'  => '',
117     '$1 GB' => '',
118Index: languages/Swedish.php
119===================================================================
120--- languages/Swedish.php       (revision 9204)
121+++ languages/Swedish.php       (working copy)
122@@ -178,6 +178,8 @@
123     'Sub and Desc (Empty matches)' => 'Undertitel & beskrivning',
124     'rectype: finddaily'           => 'En per dag',
125     'rectype: findweekly'          => 'En per vecka',
126+// includes/sorting.php
127+    '(A |An |The )'                => '',
128 // includes/utils.php
129     '$1 B'  => '$1 B',
130     '$1 GB' => '$1 GB',
131Index: languages/Dutch.php
132===================================================================
133--- languages/Dutch.php (revision 9204)
134+++ languages/Dutch.php (working copy)
135@@ -178,6 +178,8 @@
136     'Sub and Desc (Empty matches)' => 'Dubbels en Beschrijving',
137     'rectype: finddaily'           => 'Dagelijkse een uitzending opnemen.',
138     'rectype: findweekly'          => 'Wekelijkse een uitzending opnemen.',
139+// includes/sorting.php
140+    '(A |An |The )'                => '',
141 // includes/utils.php
142     '$1 B'  => '$1 B',
143     '$1 GB' => '$1 GB',
144Index: languages/German.php
145===================================================================
146--- languages/German.php        (revision 9204)
147+++ languages/German.php        (working copy)
148@@ -178,6 +178,8 @@
149     'Sub and Desc (Empty matches)' => 'Untertitel & Beschr. (kein Ergebnis)',
150     'rectype: finddaily'           => 'Suche TÀglich',
151     'rectype: findweekly'          => 'Suche Wöchentlich',
152+// includes/sorting.php
153+    '(A |An |The )'                => '',
154 // includes/utils.php
155     '$1 B'  => '$1 B',
156     '$1 GB' => '$1 GB',
157Index: languages/Japanese.php
158===================================================================
159--- languages/Japanese.php      (revision 9204)
160+++ languages/Japanese.php      (working copy)
161@@ -178,6 +178,8 @@
162     'Sub and Desc (Empty matches)' => 'サブタむトルず内容(゚ンプティヌマッチ)',
163     'rectype: finddaily'           => '䞀日䞀回',
164     'rectype: findweekly'          => '週䞀回',
165+// includes/sorting.php
166+    '(A |An |The )'                => '',
167 // includes/utils.php
168     '$1 B'  => '',
169     '$1 GB' => '',
170Index: includes/sorting.php
171===================================================================
172--- includes/sorting.php        (revision 9204)
173+++ includes/sorting.php        (working copy)
174@@ -126,7 +126,7 @@
175     }
176 
177     function by_title(&$a, &$b) {
178-        return strcasecmp($a->title, $b->title);
179+        return sort_prog_titles($a->title, $b->title);
180     }
181 
182     function by_type(&$a, &$b) {
183@@ -198,3 +198,14 @@
184         return ($a->transcoder > $b->transcoder) ? 1 : -1;
185     }
186 
187+    function strip_articles($str)
188+    {
189+        $pat = '/^' . t('(A |An |The )') . '/';
190+        echo "<!-- $pat -->\n";
191+        return preg_replace($pat, '', $str);
192+    }
193+
194+    function sort_prog_titles($a, $b) // Arguments are strings
195+    {
196+        return strcasecmp(strip_articles($a), strip_articles($b));
197+    }
198Index: modules/tv/recorded.php
199===================================================================
200--- modules/tv/recorded.php     (revision 9204)
201+++ modules/tv/recorded.php     (working copy)
202@@ -203,7 +203,7 @@
203     }
204 
205 // Sort the program titles
206-    ksort($Program_Titles);
207+    uksort($Program_Titles, 'sort_prog_titles');
208     ksort($Groups);
209 
210 // Keep track of the program/title the user wants to view