r29839 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r29838‎ | r29839 | r29840 >
Date:08:40, 16 January 2008
Author:kim
Status:old
Tags:
Comment:
i18n support siebrand style
Modified paths:
  • /trunk/extensions/Wikidata/App.php (modified) (history)
  • /trunk/extensions/Wikidata/DefaultDataset.i18n.php (added) (history)
  • /trunk/extensions/Wikidata/SpecialLanguages.i18n.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/DefaultDataset.i18n.php
@@ -0,0 +1,213 @@
 2+<?php
 3+/**
 4+ * Internationalisation file for Language Manager extension.
 5+ *
 6+ * @addtogroup Extensions
 7+*/
 8+
 9+$wgDefaultDatasetMessages = array();
 10+
 11+$wgDefaultDatasetMessages['en'] = array(
 12+ "save" => "Save",
 13+ "history" => "History",
 14+ "datasets" => "Data-set selection",
 15+ "noedit" => "You are not permitted to edit pages in the dataset \"$1\". Please see [[Project:Permission policy|our editing policy]].",
 16+ "noedit_title" => "No permission to edit",
 17+ "uipref_datasets" => "Default view",
 18+ "uiprefs" => "Wikidata",
 19+ "none_selected" => "<None selected>",
 20+ "conceptmapping_help" => "<p>possible actions: <ul>
 21+ <li>&action=insert&<data_context_prefix>=<defined_id>&... insert a mapping</li>
 22+ <li>&action=get&concept=<concept_id> read a mapping back</li>
 23+ <li>&action=list_sets return a list of possible data context prefixes and what they refer to.</li>
 24+ <li>&action=get_associated&dm=<defined_meaning_id>&dc=<dataset_context_prefix> for one defined meaning in a concept, return all others</li>
 25+ <li>&action=help Show helpful help.</li>
 26+ </ul></p>",
 27+ "conceptmapping_uitext" => "
 28+ <p>Concept Mapping allows you to identify
 29+ which defined meaning in one dataset is identical
 30+ to defined meanings in other datasets.</p>\n",
 31+ "conceptmapping_no_action_specified"=>"Apologies, I do not know how to \"$1\".",
 32+ "dm_OK"=>"OK",
 33+ "dm_not_present"=>"not entered",
 34+ "dm_not_found"=>"not found in database or malformed",
 35+ "mapping_successful"=>"Mapped all fields marked with [OK]<br>\n",
 36+ "mapping_unsuccessful"=>"Need to have at least two defined meanings before I can link them.\n",
 37+ "will_insert"=>"Will insert the following:",
 38+ "contents_of_mapping"=>"Contents of mapping",
 39+ "available_contexts"=>"Available contexts",
 40+ "add_concept_link"=>"Add link to other concepts",
 41+ "concept_panel"=>"Concept Panel",
 42+ "dm_badtitle"=>"This page does not point to any DefinedMeaning (concept). Please check the web address.",
 43+ "dm_missing"=>"This page seems to point to a non-existent DefinedMeaning (concept). Please check the web address.",
 44+ "AlternativeDefinition" => "Alternative definition",
 45+ "AlternativeDefinitions" => "Alternative definitions",
 46+ "Annotation" => "Annotation",
 47+ "ApproximateMeanings" => "Approximate meanings",
 48+ "ClassAttributeAttribute" => "Attribute",
 49+ "ClassAttributes" => "Class attributes",
 50+ "ClassAttributeLevel" => "Level",
 51+ "ClassAttributeType" => "Type",
 52+ "ClassMembership" => "Class membership",
 53+ "Collection" => "Collection",
 54+ "CollectionMembership" => "Collection membership",
 55+ "Definition" => "Definition",
 56+ "DefinedMeaningAttributes" => "Annotation",
 57+ "DefinedMeaning" => "Defined meaning",
 58+ "DefinedMeaningReference" => "Defined meaning",
 59+ "ExactMeanings" => "Exact meanings",
 60+ "Expression" => "Expression",
 61+ "ExpressionMeanings" => "Expression meanings",
 62+ "Expressions" => "Expressions",
 63+ "IdenticalMeaning" => "Identical meaning?",
 64+ "IncomingRelations" => "Incoming relations",
 65+ "GotoSource" => "Go to source",
 66+ "Language" => "Language",
 67+ "LevelAnnotation" => "Annotation",
 68+ "OptionAttribute" => "Property",
 69+ "OptionAttributeOption" => "Option",
 70+ "OptionAttributeOptions" => "Options",
 71+ "OptionAttributeValues" => "Option values",
 72+ "OtherDefinedMeaning" => "Other defined meaning",
 73+ "PopupAnnotation" => "Annotation",
 74+ "Relations" => "Relations",
 75+ "RelationType" => "Relation type",
 76+ "Spelling" => "Spelling",
 77+ "Synonyms" => "Synonyms",
 78+ "SynonymsAndTranslations" => "Synonyms and translations",
 79+ "Source" => "Source",
 80+ "SourceIdentifier" => "Source identifier",
 81+ "TextAttribute" => "Property",
 82+ "Text" => "Text",
 83+ "TextAttributeValues" => "Plain texts",
 84+ "TranslatedTextAttribute" => "Property",
 85+ "TranslatedText" => "Translated text",
 86+ "TranslatedTextAttributeValue" => "Text",
 87+ "TranslatedTextAttributeValues" => "Translatable texts",
 88+ "LinkAttribute" => "Property",
 89+ "LinkAttributeValues" => "Links",
 90+ "Property" => "Property",
 91+ "Value" => "Value",
 92+ "meaningsoftitle"=>"Meanings of \"$1\"",
 93+ "meaningsofsubtitle"=>"<em>Wiki link:</em> [[$1]]",
 94+ "Permission_denied"=>"<h2>PERMISSION DENIED</h2>",
 95+ "copy_no_action_specified"=>"Please specify an action",
 96+ "copy_help"=>"Someday, we might help you.",
 97+ "please_proved_dmid"=>"Oh dear, it seems your input is missing a ?dmid=<something> (dmid=Defined Meaning ID)<br>Whoops, please contact a server administrator.",
 98+ "please_proved_dc1"=>"Oh dear, it seems your input is missing a ?dc1=<something> (dc1=dataset context 1, dataset to copy FROM)<br>Whoops, please contact a server administrator.",
 99+ "please_proved_dc2"=>"Oh dear, it seems your input is missing a ?dc2=<something> (dc2=dataset context 2, dataset to copy TO)<br>Whoops, please contact a server administrator.",
 100+ "copy_successful"=>"<h2>Copy Successful</h2>Your data appears to have been copied successfully. Don't forget to doublecheck to make sure!",
 101+ "copy_unsuccessful"=>"<h3>Copy unsuccessful</h3> No copy operation has taken place.",
 102+ "no_action_specified"=>"<h3>No action was specified</h3> Perhaps you came to this page directly? Normally you don't need to be here.",
 103+ "db_consistency__not_found"=>"<h2>Error</h2>There is an issue with database consistency, wikidata can't find valid data connected to this defined meaning ID, it might be lost. Please contact the server operator or administrator."
 104+
 105+);
 106+
 107+$wgDefaultDatasetMessages['ar'] = array(
 108+);
 109+
 110+$wgDefaultDatasetMessages['bcl'] = array(
 111+);
 112+
 113+$wgDefaultDatasetMessages['bn'] = array(
 114+);
 115+
 116+$wgDefaultDatasetMessages['br'] = array(
 117+);
 118+
 119+$wgDefaultDatasetMessages['de'] = array(
 120+);
 121+
 122+$wgDefaultDatasetMessages['el'] = array(
 123+);
 124+
 125+$wgDefaultDatasetMessages['fr'] = array(
 126+);
 127+
 128+$wgDefaultDatasetMessages['gl'] = array(
 129+);
 130+
 131+$wgDefaultDatasetMessages['he'] = array(
 132+);
 133+
 134+$wgDefaultDatasetMessages['hsb'] = array(
 135+);
 136+
 137+$wgDefaultDatasetMessages['id'] = array(
 138+);
 139+
 140+$wgDefaultDatasetMessages['kk-kz'] = array(
 141+);
 142+
 143+$wgDefaultDatasetMessages['kk-tr'] = array(
 144+);
 145+
 146+$wgDefaultDatasetMessages['kk-cn'] = array(
 147+);
 148+
 149+$wgDefaultDatasetMessages['kk'] = $wgDefaultDatasetMessages['kk-kz'];
 150+
 151+$wgDefaultDatasetMessages['lb'] = array(
 152+);
 153+
 154+$wgDefaultDatasetMessages['nl'] = array(
 155+);
 156+
 157+$wgDefaultDatasetMessages['no'] = array(
 158+
 159+);
 160+
 161+$wgDefaultDatasetMessages['oc'] = array(
 162+);
 163+
 164+$wgDefaultDatasetMessages['pms'] = array(
 165+);
 166+
 167+$wgDefaultDatasetMessages['pt'] = array(
 168+);
 169+
 170+$wgDefaultDatasetMessages['sk'] = array(
 171+);
 172+
 173+/** Seeltersk (Seeltersk)
 174+ * @author Pyt
 175+ */
 176+$wgDefaultDatasetMessages['stq'] = array(
 177+);
 178+
 179+$wgDefaultDatasetMessages['sv'] = array(
 180+);
 181+
 182+$wgDefaultDatasetMessages['tr'] = array(
 183+);
 184+
 185+$wgDefaultDatasetMessages['zh-hans'] = array(
 186+);
 187+
 188+$wgDefaultDatasetMessages['zh-hant'] = array(
 189+);
 190+
 191+$wgDefaultDatasetMessages['yue'] = $wgDefaultDatasetMessages['zh-hant'];
 192+$wgDefaultDatasetMessages['zh'] = $wgDefaultDatasetMessages['zh-hans'];
 193+$wgDefaultDatasetMessages['zh-cn'] = $wgDefaultDatasetMessages['zh-hans'];
 194+$wgDefaultDatasetMessages['zh-hk'] = $wgDefaultDatasetMessages['zh-hant'];
 195+$wgDefaultDatasetMessages['zh-sg'] = $wgDefaultDatasetMessages['zh-hans'];
 196+$wgDefaultDatasetMessages['zh-tw'] = $wgDefaultDatasetMessages['zh-hant'];
 197+$wgDefaultDatasetMessages['zh-yue'] = $wgDefaultDatasetMessages['yue'];
 198+
 199+/** For future compatibility : merges defaultDatasetMessags into wgLanguageManagerMessages with site dataset context substitutions, in place
 200+ * @param $wgDefaultDatasetMessages ref to the messages from DefaultDataset.i18n.php
 201+ * @param $wgLanguageManagerMessages ref tp Normal i18n messages
 202+ * @param $wdSiteContext current site context.
 203+ */
 204+function defaultDataset2wgLanguageManager(&$wgDefaultDatasetMessages, &$wgLanguageManagerMessages,$wdSiteContext) {
 205+
 206+ foreach ($wgDefaultDatasetMessages as $language => $msgarray) {
 207+ $prefixedmsgarray=array();
 208+
 209+ foreach($msgarray as $key=>$value)
 210+ $prefixedmsgarray[$wdSiteContext."_".$key]=$value;
 211+
 212+ $wgLanguageManagerMessages[$language]=$prefixedmsgarray;
 213+ }
 214+}
Index: trunk/extensions/Wikidata/App.php
@@ -172,106 +172,6 @@
173173 $dbr =& wfGetDB(DB_MASTER);
174174 $dbr->query("SET NAMES utf8");
175175
176 - $msgarray = array(
177 - "save" => "Save",
178 - "history" => "History",
179 - "datasets" => "Data-set selection",
180 - "noedit" => "You are not permitted to edit pages in the dataset \"$1\". Please see [[Project:Permission policy|our editing policy]].",
181 - "noedit_title" => "No permission to edit",
182 - "uipref_datasets" => "Default view",
183 - "uiprefs" => "Wikidata",
184 - "none_selected" => "<None selected>",
185 - "conceptmapping_help" => "<p>possible actions: <ul>
186 - <li>&action=insert&<data_context_prefix>=<defined_id>&... insert a mapping</li>
187 - <li>&action=get&concept=<concept_id> read a mapping back</li>
188 - <li>&action=list_sets return a list of possible data context prefixes and what they refer to.</li>
189 - <li>&action=get_associated&dm=<defined_meaning_id>&dc=<dataset_context_prefix> for one defined meaning in a concept, return all others</li>
190 - <li>&action=help Show helpful help.</li>
191 - </ul></p>",
192 - "conceptmapping_uitext" => "
193 - <p>Concept Mapping allows you to identify
194 - which defined meaning in one dataset is identical
195 - to defined meanings in other datasets.</p>\n",
196 - "conceptmapping_no_action_specified"=>"Apologies, I do not know how to \"$1\".",
197 - "dm_OK"=>"OK",
198 - "dm_not_present"=>"not entered",
199 - "dm_not_found"=>"not found in database or malformed",
200 - "mapping_successful"=>"Mapped all fields marked with [OK]<br>\n",
201 - "mapping_unsuccessful"=>"Need to have at least two defined meanings before I can link them.\n",
202 - "will_insert"=>"Will insert the following:",
203 - "contents_of_mapping"=>"Contents of mapping",
204 - "available_contexts"=>"Available contexts",
205 - "add_concept_link"=>"Add link to other concepts",
206 - "concept_panel"=>"Concept Panel",
207 - "dm_badtitle"=>"This page does not point to any DefinedMeaning (concept). Please check the web address.",
208 - "dm_missing"=>"This page seems to point to a non-existent DefinedMeaning (concept). Please check the web address.",
209 - "AlternativeDefinition" => "Alternative definition",
210 - "AlternativeDefinitions" => "Alternative definitions",
211 - "Annotation" => "Annotation",
212 - "ApproximateMeanings" => "Approximate meanings",
213 - "ClassAttributeAttribute" => "Attribute",
214 - "ClassAttributes" => "Class attributes",
215 - "ClassAttributeLevel" => "Level",
216 - "ClassAttributeType" => "Type",
217 - "ClassMembership" => "Class membership",
218 - "Collection" => "Collection",
219 - "CollectionMembership" => "Collection membership",
220 - "Definition" => "Definition",
221 - "DefinedMeaningAttributes" => "Annotation",
222 - "DefinedMeaning" => "Defined meaning",
223 - "DefinedMeaningReference" => "Defined meaning",
224 - "ExactMeanings" => "Exact meanings",
225 - "Expression" => "Expression",
226 - "ExpressionMeanings" => "Expression meanings",
227 - "Expressions" => "Expressions",
228 - "IdenticalMeaning" => "Identical meaning?",
229 - "IncomingRelations" => "Incoming relations",
230 - "GotoSource" => "Go to source",
231 - "Language" => "Language",
232 - "LevelAnnotation" => "Annotation",
233 - "OptionAttribute" => "Property",
234 - "OptionAttributeOption" => "Option",
235 - "OptionAttributeOptions" => "Options",
236 - "OptionAttributeValues" => "Option values",
237 - "OtherDefinedMeaning" => "Other defined meaning",
238 - "PopupAnnotation" => "Annotation",
239 - "Relations" => "Relations",
240 - "RelationType" => "Relation type",
241 - "Spelling" => "Spelling",
242 - "Synonyms" => "Synonyms",
243 - "SynonymsAndTranslations" => "Synonyms and translations",
244 - "Source" => "Source",
245 - "SourceIdentifier" => "Source identifier",
246 - "TextAttribute" => "Property",
247 - "Text" => "Text",
248 - "TextAttributeValues" => "Plain texts",
249 - "TranslatedTextAttribute" => "Property",
250 - "TranslatedText" => "Translated text",
251 - "TranslatedTextAttributeValue" => "Text",
252 - "TranslatedTextAttributeValues" => "Translatable texts",
253 - "LinkAttribute" => "Property",
254 - "LinkAttributeValues" => "Links",
255 - "Property" => "Property",
256 - "Value" => "Value",
257 - "meaningsoftitle"=>"Meanings of \"$1\"",
258 - "meaningsofsubtitle"=>"<em>Wiki link:</em> [[$1]]",
259 - "Permission_denied"=>"<h2>PERMISSION DENIED</h2>",
260 - "copy_no_action_specified"=>"Please specify an action",
261 - "copy_help"=>"Someday, we might help you.",
262 - "please_proved_dmid"=>"Oh dear, it seems your input is missing a ?dmid=<something> (dmid=Defined Meaning ID)<br>Whoops, please contact a server administrator.",
263 - "please_proved_dc1"=>"Oh dear, it seems your input is missing a ?dc1=<something> (dc1=dataset context 1, dataset to copy FROM)<br>Whoops, please contact a server administrator.",
264 - "please_proved_dc2"=>"Oh dear, it seems your input is missing a ?dc2=<something> (dc2=dataset context 2, dataset to copy TO)<br>Whoops, please contact a server administrator.",
265 - "copy_successful"=>"<h2>Copy Successful</h2>Your data appears to have been copied successfully. Don't forget to doublecheck to make sure!",
266 - "db_consistency__not_found"=>"<h2>Error</h2>There is an issue with database consistency, wikidata can't find valid data connected to this defined meaning ID, it might be lost. Please contact the server operator or administrator."
267 - );
268 -
269 - $prefixedmsgarray=array();
270 -
271 - foreach($msgarray as $key=>$value)
272 - $prefixedmsgarray[$wdSiteContext."_".$key]=$value;
273 -
274 - $wgMessageCache->addMessages($prefixedmsgarray);
275 -
276176 $datasets=wdGetDatasets();
277177 $datasetarray['']=wfMsgHtml('ow_none_selected');
278178 foreach($datasets as $datasetid=>$dataset) {
@@ -297,3 +197,4 @@
298198
299199 return true;
300200 }
 201+
Index: trunk/extensions/Wikidata/SpecialLanguages.i18n.php
@@ -5,6 +5,7 @@
66 * @addtogroup Extensions
77 */
88
 9+
910 $wgLanguageManagerMessages = array();
1011
1112 $wgLanguageManagerMessages['en'] = array(
@@ -158,3 +159,10 @@
159160 $wgLanguageManagerMessages['zh-sg'] = $wgLanguageManagerMessages['zh-hans'];
160161 $wgLanguageManagerMessages['zh-tw'] = $wgLanguageManagerMessages['zh-hant'];
161162 $wgLanguageManagerMessages['zh-yue'] = $wgLanguageManagerMessages['yue'];
 163+
 164+global
 165+ $IP, $wdSiteContext;
 166+require_once("{$IP}/extensions/Wikidata/DefaultDataset.i18n.php");
 167+global $wgDefaultDatasetMessages;
 168+defaultDataset2wgLanguageManager($wgDefaultDatasetMessages, $wgLanguageManagerMessages, $wdSiteContext);
 169+

Status & tagging log