r26379 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r26378‎ | r26379 | r26380 >
Date:17:34, 3 October 2007
Author:mkroetzsch
Status:old
Tags:
Comment:
Optional namespace aliases for all SMW namespaces. English aliases added for existing languages.
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/languages/SMW_Language.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageDe.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageEn.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageEs.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageFr.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageHe.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageNl.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/languages/SMW_LanguagePl.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageRu.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageSk.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php
@@ -242,14 +242,12 @@
243243 * greater or equal to 100.
244244 */
245245 function smwfInitNamespaces() {
246 - global $smwgNamespaceIndex, $wgExtraNamespaces, $wgNamespacesWithSubpages, $wgLanguageCode, $smwgContLang;
 246+ global $smwgNamespaceIndex, $wgExtraNamespaces, $wgNamespaceAliases, $wgNamespacesWithSubpages, $wgLanguageCode, $smwgContLang;
247247
248248 if (!isset($smwgNamespaceIndex)) {
249249 $smwgNamespaceIndex = 100;
250250 }
251251
252 - smwfInitContentLanguage($wgLanguageCode);
253 -
254252 define('SMW_NS_PROPERTY', $smwgNamespaceIndex+2);
255253 define('SMW_NS_PROPERTY_TALK', $smwgNamespaceIndex+3);
256254 define('SMW_NS_TYPE', $smwgNamespaceIndex+4);
@@ -259,9 +257,13 @@
260258 define('SMW_NS_RELATION', $smwgNamespaceIndex);
261259 define('SMW_NS_RELATION_TALK', $smwgNamespaceIndex+1);
262260
 261+ smwfInitContentLanguage($wgLanguageCode);
 262+
263263 // Register namespace identifiers
264264 if (!is_array($wgExtraNamespaces)) { $wgExtraNamespaces=array(); }
265 - $wgExtraNamespaces = $wgExtraNamespaces + $smwgContLang->getNamespaceArray();
 265+ $wgExtraNamespaces = $wgExtraNamespaces + $smwgContLang->getNamespaces();
 266+ $wgNamespaceAliases = $wgNamespaceAliases + $smwgContLang->getNamespaceAliases();
 267+
266268
267269 // Support subpages only for talk pages by default
268270 $wgNamespacesWithSubpages = $wgNamespacesWithSubpages + array(
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_Language.php
@@ -14,13 +14,25 @@
1515 protected $smwSpecialProperties;
1616 protected $m_DatatypeLabels;
1717 protected $m_DatatypeAliases = array();
 18+ protected $m_Namespaces;
 19+ protected $m_NamespaceAliases = array();
 20+
1821
1922 /**
2023 * Function that returns an array of namespace identifiers.
2124 */
22 - abstract function getNamespaceArray();
 25+ function getNamespaces() {
 26+ return $this->m_Namespaces;
 27+ }
2328
2429 /**
 30+ * Function that returns an array of namespace aliases, if any.
 31+ */
 32+ function getNamespaceAliases() {
 33+ return $this->m_NamespaceAliases;
 34+ }
 35+
 36+ /**
2537 * Return all labels that are available as names for built-in datatypes. Those
2638 * are the types that users can access via [[has type::...]] (more built-in
2739 * types may exist for internal purposes but the user won't need to
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageEn.php
@@ -212,19 +212,15 @@
213213 SMW_SP_POSSIBLE_VALUE => 'Allows value'
214214 );
215215
216 - /**
217 - * Function that returns the namespace identifiers.
218 - */
219 - public function getNamespaceArray() {
220 - return array(
221 - SMW_NS_RELATION => 'Relation',
222 - SMW_NS_RELATION_TALK => 'Relation_talk',
223 - SMW_NS_PROPERTY => 'Property',
224 - SMW_NS_PROPERTY_TALK => 'Property_talk',
225 - SMW_NS_TYPE => 'Type',
226 - SMW_NS_TYPE_TALK => 'Type_talk'
227 - );
228 - }
 216+protected $m_Namespaces = array(
 217+ SMW_NS_RELATION => 'Relation',
 218+ SMW_NS_RELATION_TALK => 'Relation_talk',
 219+ SMW_NS_PROPERTY => 'Property',
 220+ SMW_NS_PROPERTY_TALK => 'Property_talk',
 221+ SMW_NS_TYPE => 'Type',
 222+ SMW_NS_TYPE_TALK => 'Type_talk'
 223+);
 224+
229225 }
230226
231227
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageRu.php
@@ -240,17 +240,23 @@
241241 );
242242
243243
244 - /**
245 - * Function that returns the namespace identifiers.
246 - */
247 - public function getNamespaceArray() {
248 - return array(
249 - SMW_NS_RELATION => 'Отношение',
250 - SMW_NS_RELATION_TALK => 'Отношение_дискуссия',
251 - SMW_NS_PROPERTY => 'Атрибут',
252 - SMW_NS_PROPERTY_TALK => 'Атрибут_дискуссия',
253 - SMW_NS_TYPE => 'Тип',
254 - SMW_NS_TYPE_TALK => 'Тип_дискуссия'
255 - );
256 - }
 244+protected $m_Namespaces = array(
 245+ SMW_NS_RELATION => 'Отношение',
 246+ SMW_NS_RELATION_TALK => 'Отношение_дискуссия',
 247+ SMW_NS_PROPERTY => 'Атрибут',
 248+ SMW_NS_PROPERTY_TALK => 'Атрибут_дискуссия',
 249+ SMW_NS_TYPE => 'Тип',
 250+ SMW_NS_TYPE_TALK => 'Тип_дискуссия'
 251+);
 252+
 253+protected $m_NamespaceAliases = array(
 254+ // support English aliases for namespaces
 255+ 'Relation' => SMW_NS_RELATION,
 256+ 'Relation_talk' => SMW_NS_RELATION_TALK,
 257+ 'Property' => SMW_NS_PROPERTY,
 258+ 'Property_talk' => SMW_NS_PROPERTY_TALK,
 259+ 'Type' => SMW_NS_TYPE,
 260+ 'Type_talk' => SMW_NS_TYPE_TALK
 261+);
 262+
257263 }
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageEs.php
@@ -231,19 +231,25 @@
232232 SMW_SP_POSSIBLE_VALUE => 'Permite el valor'
233233 );
234234
235 - /**
236 - * Function that returns the namespace identifiers.
237 - */
238 - function getNamespaceArray() {
239 - return array(
240 - SMW_NS_RELATION => "Relación",
241 - SMW_NS_RELATION_TALK => "Discusión_relación",
242 - SMW_NS_PROPERTY => "Atributo",
243 - SMW_NS_PROPERTY_TALK => "Discusión_atributo",
244 - SMW_NS_TYPE => "Tipos_de_datos",
245 - SMW_NS_TYPE_TALK => "Discusión_tipos_de_datos"
246 - );
247 - }
 235+protected $m_Namespaces = array(
 236+ SMW_NS_RELATION => "Relación",
 237+ SMW_NS_RELATION_TALK => "Discusión_relación",
 238+ SMW_NS_PROPERTY => "Atributo",
 239+ SMW_NS_PROPERTY_TALK => "Discusión_atributo",
 240+ SMW_NS_TYPE => "Tipos_de_datos",
 241+ SMW_NS_TYPE_TALK => "Discusión_tipos_de_datos"
 242+);
 243+
 244+protected $m_NamespaceAliases = array(
 245+ // support English aliases for namespaces
 246+ 'Relation' => SMW_NS_RELATION,
 247+ 'Relation_talk' => SMW_NS_RELATION_TALK,
 248+ 'Property' => SMW_NS_PROPERTY,
 249+ 'Property_talk' => SMW_NS_PROPERTY_TALK,
 250+ 'Type' => SMW_NS_TYPE,
 251+ 'Type_talk' => SMW_NS_TYPE_TALK
 252+);
 253+
248254 }
249255
250256
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageFr.php
@@ -232,19 +232,25 @@
233233 SMW_SP_POSSIBLE_VALUE => 'Valeur possible'
234234 );
235235
236 - /**
237 - * Function that returns the namespace identifiers.
238 - */
239 - public function getNamespaceArray() {
240 - return array(
241 - SMW_NS_RELATION => "Relation",
242 - SMW_NS_RELATION_TALK => "Discussion_relation",
243 - SMW_NS_PROPERTY => "Attribut",
244 - SMW_NS_PROPERTY_TALK => "Discussion_attribut",
245 - SMW_NS_TYPE => "Type",
246 - SMW_NS_TYPE_TALK => "Discussion_type"
247 - );
248 - }
 236+protected $m_Namespaces = array(
 237+ SMW_NS_RELATION => "Relation",
 238+ SMW_NS_RELATION_TALK => "Discussion_relation",
 239+ SMW_NS_PROPERTY => "Attribut",
 240+ SMW_NS_PROPERTY_TALK => "Discussion_attribut",
 241+ SMW_NS_TYPE => "Type",
 242+ SMW_NS_TYPE_TALK => "Discussion_type"
 243+);
 244+
 245+protected $m_NamespaceAliases = array(
 246+ // support English aliases for namespaces
 247+ //'Relation' => SMW_NS_RELATION,
 248+ 'Relation_talk' => SMW_NS_RELATION_TALK,
 249+ 'Property' => SMW_NS_PROPERTY,
 250+ 'Property_talk' => SMW_NS_PROPERTY_TALK,
 251+ 'Type' => SMW_NS_TYPE,
 252+ 'Type_talk' => SMW_NS_TYPE_TALK
 253+);
 254+
249255 }
250256
251257
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageDe.php
@@ -221,20 +221,25 @@
222222 SMW_SP_POSSIBLE_VALUE => 'Erlaubt Wert'
223223 );
224224
225 - /**
226 - * Function that returns the namespace identifiers.
227 - */
228 - public function getNamespaceArray() {
229 - return array(
230 - SMW_NS_RELATION => "Relation",
231 - SMW_NS_RELATION_TALK => "Relation_Diskussion",
232 - SMW_NS_PROPERTY => "Attribut",
233 - SMW_NS_PROPERTY_TALK => "Attribut_Diskussion",
234 - SMW_NS_TYPE => "Datentyp",
235 - SMW_NS_TYPE_TALK => "Datentyp_Diskussion"
236 - );
237 - }
 225+protected $m_Namespaces = array(
 226+ SMW_NS_RELATION => "Relation",
 227+ SMW_NS_RELATION_TALK => "Relation_Diskussion",
 228+ SMW_NS_PROPERTY => "Attribut",
 229+ SMW_NS_PROPERTY_TALK => "Attribut_Diskussion",
 230+ SMW_NS_TYPE => "Datentyp",
 231+ SMW_NS_TYPE_TALK => "Datentyp_Diskussion"
 232+);
238233
 234+protected $m_NamespaceAliases = array(
 235+ // support English aliases for namespaces
 236+ //'Relation' => SMW_NS_RELATION,
 237+ 'Relation_talk' => SMW_NS_RELATION_TALK,
 238+ 'Property' => SMW_NS_PROPERTY,
 239+ 'Property_talk' => SMW_NS_PROPERTY_TALK,
 240+ 'Type' => SMW_NS_TYPE,
 241+ 'Type_talk' => SMW_NS_TYPE_TALK
 242+);
 243+
239244 }
240245
241246
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageNl.php
@@ -217,17 +217,23 @@
218218 SMW_SP_POSSIBLE_VALUE => 'Geldige waarde'
219219 );
220220
221 - /**
222 - * Function that returns the namespace identifiers.
223 - */
224 - public function getNamespaceArray() {
225 - return array(
226 - SMW_NS_RELATION => 'Relatie',
227 - SMW_NS_RELATION_TALK => 'Overleg_relatie',
228 - SMW_NS_PROPERTY => 'Eigenschap',
229 - SMW_NS_PROPERTY_TALK => 'Overleg_eigenschap',
230 - SMW_NS_TYPE => 'Type',
231 - SMW_NS_TYPE_TALK => 'Overleg_type'
232 - );
233 - }
 221+protected $m_Namespaces = array(
 222+ SMW_NS_RELATION => 'Relatie',
 223+ SMW_NS_RELATION_TALK => 'Overleg_relatie',
 224+ SMW_NS_PROPERTY => 'Eigenschap',
 225+ SMW_NS_PROPERTY_TALK => 'Overleg_eigenschap',
 226+ SMW_NS_TYPE => 'Type',
 227+ SMW_NS_TYPE_TALK => 'Overleg_type'
 228+);
 229+
 230+protected $m_NamespaceAliases = array(
 231+ // support English aliases for namespaces
 232+ 'Relation' => SMW_NS_RELATION,
 233+ 'Relation_talk' => SMW_NS_RELATION_TALK,
 234+ 'Property' => SMW_NS_PROPERTY,
 235+ 'Property_talk' => SMW_NS_PROPERTY_TALK,
 236+ 'Type' => SMW_NS_TYPE,
 237+ 'Type_talk' => SMW_NS_TYPE_TALK
 238+);
 239+
234240 }
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_LanguagePl.php
@@ -264,19 +264,25 @@
265265 );
266266
267267
268 - /**
269 - * Function that returns the namespace identifiers.
270 - */
271 - public function getNamespaceArray() {
272 - return array(
273 - SMW_NS_RELATION => 'Relacja',
274 - SMW_NS_RELATION_TALK => 'Dyskusja_relacji',
275 - SMW_NS_PROPERTY => 'Atrybut',
276 - SMW_NS_PROPERTY_TALK => 'Dyskusja_atrybutu',
277 - SMW_NS_TYPE => 'Typ',
278 - SMW_NS_TYPE_TALK => 'Dyskusja_typu'
279 - );
280 - }
 268+protected $m_Namespaces = array(
 269+ SMW_NS_RELATION => 'Relacja',
 270+ SMW_NS_RELATION_TALK => 'Dyskusja_relacji',
 271+ SMW_NS_PROPERTY => 'Atrybut',
 272+ SMW_NS_PROPERTY_TALK => 'Dyskusja_atrybutu',
 273+ SMW_NS_TYPE => 'Typ',
 274+ SMW_NS_TYPE_TALK => 'Dyskusja_typu'
 275+);
 276+
 277+protected $m_NamespaceAliases = array(
 278+ // support English aliases for namespaces
 279+ 'Relation' => SMW_NS_RELATION,
 280+ 'Relation_talk' => SMW_NS_RELATION_TALK,
 281+ 'Property' => SMW_NS_PROPERTY,
 282+ 'Property_talk' => SMW_NS_PROPERTY_TALK,
 283+ 'Type' => SMW_NS_TYPE,
 284+ 'Type_talk' => SMW_NS_TYPE_TALK
 285+);
 286+
281287 }
282288
283289
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageHe.php
@@ -244,17 +244,23 @@
245245 );
246246
247247
248 - /**
249 - * Function that returns the namespace identifiers.
250 - */
251 - public function getNamespaceArray() {
252 - return array(
253 - SMW_NS_RELATION => 'יחס',
254 - SMW_NS_RELATION_TALK => 'שיחת_יחס',
255 - SMW_NS_PROPERTY => 'תכונה',
256 - SMW_NS_PROPERTY_TALK => 'שיחת_תכונה',
257 - SMW_NS_TYPE => 'טיפוס',
258 - SMW_NS_TYPE_TALK => 'שיחת_טיפוס'
259 - );
260 - }
 248+protected $m_Namespaces = array(
 249+ SMW_NS_RELATION => 'יחס',
 250+ SMW_NS_RELATION_TALK => 'שיחת_יחס',
 251+ SMW_NS_PROPERTY => 'תכונה',
 252+ SMW_NS_PROPERTY_TALK => 'שיחת_תכונה',
 253+ SMW_NS_TYPE => 'טיפוס',
 254+ SMW_NS_TYPE_TALK => 'שיחת_טיפוס'
 255+);
 256+
 257+protected $m_NamespaceAliases = array(
 258+ // support English aliases for namespaces
 259+ 'Relation' => SMW_NS_RELATION,
 260+ 'Relation_talk' => SMW_NS_RELATION_TALK,
 261+ 'Property' => SMW_NS_PROPERTY,
 262+ 'Property_talk' => SMW_NS_PROPERTY_TALK,
 263+ 'Type' => SMW_NS_TYPE,
 264+ 'Type_talk' => SMW_NS_TYPE_TALK
 265+);
 266+
261267 }
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageSk.php
@@ -241,19 +241,25 @@
242242 );
243243
244244
245 - /**
246 - * Function that returns the namespace identifiers.
247 - */
248 - public function getNamespaceArray() {
249 - return array(
250 - SMW_NS_RELATION => 'Vzťah',
251 - SMW_NS_RELATION_TALK => 'Diskusia o vzťahu',
252 - SMW_NS_PROPERTY => 'Atribút',
253 - SMW_NS_PROPERTY_TALK => 'Diskusia o atribúte',
254 - SMW_NS_TYPE => 'Typ',
255 - SMW_NS_TYPE_TALK => 'Diskusia o type'
256 - );
257 - }
 245+protected $m_Namespaces = array(
 246+ SMW_NS_RELATION => 'Vzťah',
 247+ SMW_NS_RELATION_TALK => 'Diskusia o vzťahu',
 248+ SMW_NS_PROPERTY => 'Atribút',
 249+ SMW_NS_PROPERTY_TALK => 'Diskusia o atribúte',
 250+ SMW_NS_TYPE => 'Typ',
 251+ SMW_NS_TYPE_TALK => 'Diskusia o type'
 252+);
 253+
 254+protected $m_NamespaceAliases = array(
 255+ // support English aliases for namespaces
 256+ 'Relation' => SMW_NS_RELATION,
 257+ 'Relation_talk' => SMW_NS_RELATION_TALK,
 258+ 'Property' => SMW_NS_PROPERTY,
 259+ 'Property_talk' => SMW_NS_PROPERTY_TALK,
 260+ 'Type' => SMW_NS_TYPE,
 261+ 'Type_talk' => SMW_NS_TYPE_TALK
 262+);
 263+
258264 }
259265
260266

Status & tagging log