Index: trunk/extensions/SemanticMediaWiki/specials/QueryPages/SMW_SpecialTypes.php |
— | — | @@ -55,7 +55,7 @@ |
56 | 56 | $sql = "(SELECT 'Types' as type, {$NStype} as namespace, page_title as title, " . |
57 | 57 | "page_title as value, 1 as count FROM $page WHERE page_namespace = $NStype)"; |
58 | 58 | // make SQL for built-in datatypes |
59 | | - foreach ($smwgContLang->getAllDatatypeLabels() as $label) { |
| 59 | + foreach (SMWDataValueFactory::getKnownTypeLabels() as $label) { |
60 | 60 | $label = str_replace(' ', '_', $label); // DBkey form so that SQL can elminate duplicates |
61 | 61 | $sql .= " UNION (SELECT 'Types' as type, {$NStype} as namespace, '$label' as title, " . |
62 | 62 | "'$label' as value, 1 as count)"; |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DT_DateTime.php |
— | — | @@ -17,7 +17,7 @@ |
18 | 18 | /** @public */ |
19 | 19 | |
20 | 20 | function getID() { |
21 | | - return 'datetime'; |
| 21 | + return '_dat'; |
22 | 22 | } |
23 | 23 | |
24 | 24 | function getXSDType() { |
— | — | @@ -129,8 +129,4 @@ |
130 | 130 | } |
131 | 131 | } //SMWDateTimeTypeHandler |
132 | 132 | |
133 | | -//register type handler: |
134 | | -//SMWTypeHandlerFactory::registerTypeHandler($smwgContLang->getDatatypeLabel('smw_datetime'), |
135 | | -// new SMWDateTimeTypeHandler()); |
136 | 133 | |
137 | | - |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DT_Integer.php |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | class SMWIntegerTypeHandler implements SMWTypeHandler { |
13 | 13 | |
14 | 14 | function getID() { |
15 | | - return 'int'; |
| 15 | + return '_int'; |
16 | 16 | } |
17 | 17 | |
18 | 18 | function getXSDType() { |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DT_URI.php |
— | — | @@ -48,10 +48,10 @@ |
49 | 49 | |
50 | 50 | function getID() { |
51 | 51 | switch ($this->mMode) { |
52 | | - case SMW_URI_MODE_EMAIL: return 'email'; |
53 | | - case SMW_URI_MODE_URL: return 'url'; |
54 | | - case SMW_URI_MODE_URI: return 'uri'; |
55 | | - case SMW_URI_MODE_ANNOURI: return 'annouri'; |
| 52 | + case SMW_URI_MODE_EMAIL: return '_ema'; |
| 53 | + case SMW_URI_MODE_URL: return '_url'; |
| 54 | + case SMW_URI_MODE_URI: return '_uri'; |
| 55 | + case SMW_URI_MODE_ANNOURI: return '_anu'; |
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_WikiPage.php |
— | — | @@ -33,7 +33,7 @@ |
34 | 34 | $this->m_namespace = $this->m_title->getNamespace(); |
35 | 35 | $this->m_id = false; // unset id |
36 | 36 | if ($this->m_caption === false) { |
37 | | - $this->m_caption = $this->m_prefixedtext; |
| 37 | + $this->m_caption = $value; |
38 | 38 | } |
39 | 39 | } else { |
40 | 40 | $this->addError('Invalid title string'); // TODO: internationalise |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DT_Enum.php |
— | — | @@ -12,7 +12,7 @@ |
13 | 13 | class SMWEnumTypeHandler implements SMWTypeHandler { |
14 | 14 | |
15 | 15 | function getID() { |
16 | | - return 'enum'; |
| 16 | + return '_enu'; |
17 | 17 | } |
18 | 18 | |
19 | 19 | // Can't represent any better way than as a string |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DT_Float.php |
— | — | @@ -28,7 +28,7 @@ |
29 | 29 | * ID string for the datatype object |
30 | 30 | * @access protected |
31 | 31 | */ |
32 | | - protected $typeid = 'float'; |
| 32 | + protected $typeid = '_flt'; |
33 | 33 | /** |
34 | 34 | * Primary unit for this type, false if none. |
35 | 35 | * @see getPrimaryUnit() |
— | — | @@ -351,7 +351,7 @@ |
352 | 352 | |
353 | 353 | } // End SMWFloatTypeHandler} |
354 | 354 | |
355 | | -SMWTypeHandlerFactory::registerTypeHandler($smwgContLang->getDatatypeLabel('smw_float'), |
| 355 | +SMWTypeHandlerFactory::registerTypeHandler('_flt', |
356 | 356 | new SMWFloatTypeHandler()); |
357 | 357 | |
358 | 358 | |
— | — | @@ -534,7 +534,7 @@ |
535 | 535 | /**#@+ |
536 | 536 | * @access private |
537 | 537 | */ |
538 | | - var $typeid = 'temperature'; |
| 538 | + var $typeid = '_tem'; |
539 | 539 | var $primaryUnit = 'K'; |
540 | 540 | var $otherDisplayUnits = array('°C', '°F'); |
541 | 541 | |
— | — | @@ -595,7 +595,7 @@ |
596 | 596 | } |
597 | 597 | } // End class SMWTemperatureTypeHandler |
598 | 598 | |
599 | | -SMWTypeHandlerFactory::registerTypeHandler($smwgContLang->getDatatypeLabel('smw_temperature'), |
| 599 | +SMWTypeHandlerFactory::registerTypeHandler('_tem', |
600 | 600 | new SMWTemperatureTypeHandler()); |
601 | 601 | |
602 | 602 | |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Types.php |
— | — | @@ -15,39 +15,9 @@ |
16 | 16 | class SMWTypesValue extends SMWDataValue { |
17 | 17 | |
18 | 18 | private $m_typelabels = false; |
| 19 | + private $m_typecaptions = false; |
19 | 20 | private $m_xsdvalue = false; |
20 | 21 | |
21 | | - /** |
22 | | - * This associative array links message ids for type label to internal type |
23 | | - * ids. Datavalue classes register for certain internal type ids, and this |
24 | | - * class establishes the required mapping. No id must be duplicated, and |
25 | | - * ids should in general not be changed, since they act as universal handles |
26 | | - * for types throughout the code. The registration happens in |
27 | | - * SMW_DataValueFactory.php |
28 | | - */ |
29 | | - static private $m_typeids = array( |
30 | | - 'smw_wikipage' => '_wpg', |
31 | | - 'smw_string' => '_str', |
32 | | - 'smw_text' => '_txt', |
33 | | - 'smw_enum' => '_enu', |
34 | | - 'smw_bool' => '_boo', |
35 | | - 'smw_int' => '_int', |
36 | | - 'smw_float' => '_flt', |
37 | | - //case 'smw_length' |
38 | | - //case 'smw_area' |
39 | | - //case 'smw_geolength' |
40 | | - //case 'smw_geoarea' |
41 | | - 'smw_geocoordinate' => '_crd', |
42 | | - //case 'smw_mass' |
43 | | - 'smw_time' => '_tim', |
44 | | - 'smw_temperature' => '_tmp', |
45 | | - 'smw_datetime' => '_dat', |
46 | | - 'smw_email' => '_ema', |
47 | | - 'smw_url' => '_url', |
48 | | - 'smw_uri' => '_uri', |
49 | | - 'smw_annouri' => '_anu' |
50 | | - ); |
51 | | - |
52 | 22 | protected function parseUserValue($value) { |
53 | 23 | // no use for being lazy here: plain user values are never useful |
54 | 24 | $this->m_typelabels = array(); |
— | — | @@ -57,7 +27,8 @@ |
58 | 28 | $type = rtrim($type, ' ]'); |
59 | 29 | $ttype = Title::newFromText($type,SMW_NS_TYPE); |
60 | 30 | if ($ttype->getNamespace() == SMW_NS_TYPE) { |
61 | | - $this->m_typelabels[] = $ttype->getText(); |
| 31 | + $this->m_typecaptions[] = $type; |
| 32 | + $this->m_typelabels[] = SMWDataValueFactory::findTypeLabel(SMWDataValueFactory::findTypeID($ttype->getText())); |
62 | 33 | } // else: wrong namespace given -- what now? TODO |
63 | 34 | } |
64 | 35 | } |
— | — | @@ -71,17 +42,68 @@ |
72 | 43 | } |
73 | 44 | |
74 | 45 | public function getShortWikiText($linked = NULL) { |
75 | | - if ($this->m_caption !== false) { |
76 | | - return $this->m_caption; |
| 46 | + if ( ($linked === NULL) || ($linked === false) ) { |
| 47 | + if ($this->m_caption !== false) { |
| 48 | + return $this->m_caption; |
| 49 | + } else { |
| 50 | + return str_replace('_',' ',implode(', ', $this->getTypeCaptions())); |
| 51 | + } |
| 52 | + } else { |
| 53 | + global $wgContLang; |
| 54 | + $typenamespace = $wgContLang->getNsText(SMW_NS_TYPE); |
| 55 | + if ($this->m_caption !== false) { |
| 56 | + if ($this->isUnary()) { |
| 57 | + return '[[' . $typenamespace . ':' . $this->getWikiValue() . '|' . $this->m_caption . ']]'; |
| 58 | + } else { |
| 59 | + return $this->m_caption; |
| 60 | + } |
| 61 | + } |
| 62 | + $result = ''; |
| 63 | + $first = true; |
| 64 | + $captions = $this->getTypeCaptions(); |
| 65 | + reset($captions); |
| 66 | + foreach ($this->getTypeLabels() as $type) { |
| 67 | + $caption = next($captions); |
| 68 | + if ($first) { |
| 69 | + $first = false; |
| 70 | + } else { |
| 71 | + $result .= ', '; |
| 72 | + } |
| 73 | + $result .= '[[' . $typenamespace . ':' . $type . '|' . $caption . ']]'; |
| 74 | + } |
| 75 | + return $result; |
77 | 76 | } |
78 | | - return $this->getLongWikiText($linked); |
79 | 77 | } |
80 | 78 | |
81 | 79 | public function getShortHTMLText($linker = NULL) { |
82 | | - if ($this->m_caption !== false) { |
83 | | - return htmlspecialchars($this->m_caption); |
| 80 | + if ( ($linker === NULL) || ($linker === false) ) { |
| 81 | + if ($this->m_caption !== false) { |
| 82 | + return htmlspecialchars($this->m_caption); |
| 83 | + } else { |
| 84 | + return str_replace('_',' ',implode(', ', $this->getTypeCaptions())); |
| 85 | + } |
| 86 | + } else { |
| 87 | + if ($this->m_caption !== false) { |
| 88 | + if ($this->isUnary()) { |
| 89 | + $title = Title::newFromText($this->getWikiValue(), SMW_NS_TYPE); |
| 90 | + return $linker->makeLinkObj($title, $this->m_caption); |
| 91 | + } else { |
| 92 | + return htmlspecialchars($this->m_caption); |
| 93 | + } |
| 94 | + } |
| 95 | + $result = ''; |
| 96 | + $first = true; |
| 97 | + foreach ($this->getTypeLabels() as $type) { |
| 98 | + if ($first) { |
| 99 | + $first = false; |
| 100 | + } else { |
| 101 | + $result .= ', '; |
| 102 | + } |
| 103 | + $title = Title::newFromText($type, SMW_NS_TYPE); |
| 104 | + $result .= $linker->makeLinkObj( $title, $type); |
| 105 | + } |
| 106 | + return $result; |
84 | 107 | } |
85 | | - return $this->getLongHTMLText($linker); |
86 | 108 | } |
87 | 109 | |
88 | 110 | public function getLongWikiText($linked = NULL) { |
— | — | @@ -134,7 +156,7 @@ |
135 | 157 | } else { |
136 | 158 | $this->m_xsdvalue .= ';'; |
137 | 159 | } |
138 | | - $this->m_xsdvalue .= SMWTypesValue::findTypeID($label); |
| 160 | + $this->m_xsdvalue .= SMWDataValueFactory::findTypeID($label); |
139 | 161 | } |
140 | 162 | } |
141 | 163 | return $this->m_xsdvalue; |
— | — | @@ -181,7 +203,7 @@ |
182 | 204 | } |
183 | 205 | |
184 | 206 | /** |
185 | | - * Is this a built-in datatype shipped with SMW? |
| 207 | + * Is this a built-in datatype shipped with SMW (or an extension of SMW)? |
186 | 208 | * (Alternatively it would be a user-defined derived datatype.) |
187 | 209 | */ |
188 | 210 | public function isBuiltIn() { |
— | — | @@ -193,16 +215,40 @@ |
194 | 216 | * Retrieve type labels if needed. Can be done lazily. |
195 | 217 | */ |
196 | 218 | public function getTypeLabels() { |
| 219 | + $this->initTypeData(); |
| 220 | + if ($this->m_typelabels === false) { |
| 221 | + return array(); // fallback for unary callers |
| 222 | + } else { |
| 223 | + return $this->m_typelabels; |
| 224 | + } |
| 225 | + } |
| 226 | + |
| 227 | + /** |
| 228 | + * Retrieve type captions if needed. Can be done lazily. The captions |
| 229 | + * are different from the labels if type aliases are used. |
| 230 | + */ |
| 231 | + public function getTypeCaptions() { |
| 232 | + $this->initTypeData(); |
| 233 | + if ($this->m_typecaptions === false) { |
| 234 | + return array(); // fallback for unary callers |
| 235 | + } else { |
| 236 | + return $this->m_typecaptions; |
| 237 | + } |
| 238 | + } |
| 239 | + |
| 240 | + /** |
| 241 | + * Internal method to extract data from XSD-representation. Called lazily. |
| 242 | + */ |
| 243 | + protected function initTypeData() { |
197 | 244 | if ( ($this->m_typelabels === false) && ($this->m_xsdvalue !== false) ) { |
198 | 245 | $this->m_typelabels = array(); |
199 | 246 | $ids = explode(';', $this->m_xsdvalue); |
200 | 247 | foreach ($ids as $id) { |
201 | | - $this->m_typelabels[] = SMWTypesValue::findTypeLabel($id); |
| 248 | + $label = SMWDataValueFactory::findTypeLabel($id); |
| 249 | + $this->m_typelabels[] = $label; |
| 250 | + $this->m_typecaptions[] = $label; |
202 | 251 | } |
203 | | - } elseif ($this->m_typelabels === false) { |
204 | | - return array(); // fallback for unwary callers |
205 | 252 | } |
206 | | - return $this->m_typelabels; // false only if nothing set yet |
207 | 253 | } |
208 | 254 | |
209 | 255 | /** |
— | — | @@ -219,39 +265,5 @@ |
220 | 266 | return $result; |
221 | 267 | } |
222 | 268 | |
223 | | - /** |
224 | | - * Get the language independent id for some type label (e.g. "_int" for "Integer"). |
225 | | - * This id is used for all internal operations. Compound types are not supported |
226 | | - * by this method (decomposition happens earlier). Custom types get their DBkeyed |
227 | | - * label as id. All ids are prefixed by an underscore in order to distinguish them |
228 | | - * from custom types. |
229 | | - */ |
230 | | - static public function findTypeID($label) { |
231 | | - global $smwgContLang; |
232 | | - $msgid = $smwgContLang->findDatatypeMsgID($label); |
233 | | - if ( ($msgid !== false) && (array_key_exists($msgid, SMWTypesValue::$m_typeids)) ) { |
234 | | - return SMWTypesValue::$m_typeids[$msgid]; |
235 | | - } else { // hopefully $msgid was just FALSE ... |
236 | | - return str_replace(' ', '_', $label); |
237 | | - } |
238 | | - } |
239 | | - |
240 | | - /** |
241 | | - * Inverse of findTypeID(); |
242 | | - */ |
243 | | - static public function findTypeLabel($id) { |
244 | | - global $smwgContLang; |
245 | | - if ($id{0} === '_') { |
246 | | - $key = array_search($id, SMWTypesValue::$m_typeids); |
247 | | - if ($key !== false) { |
248 | | - return $smwgContLang->getDatatypeLabel($key); |
249 | | - } else { // maybe some no longer supported type? |
250 | | - return str_replace('_', ' ', $id); |
251 | | - } |
252 | | - } else { |
253 | | - return str_replace('_', ' ', $id); |
254 | | - } |
255 | | - } |
256 | | - |
257 | 269 | } |
258 | 270 | |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DataValueFactory.php |
— | — | @@ -16,17 +16,27 @@ |
17 | 17 | class SMWDataValueFactory { |
18 | 18 | |
19 | 19 | /** |
20 | | - * Array of class names and initialisation data for creating |
21 | | - * new SMWDataValues. Indexed by type label (without namespace). |
22 | | - * Each entry has the form |
23 | | - * array(included?, filepart, classname); |
| 20 | + * Array of type labels indexed by type ids. Used for datatype |
| 21 | + * resolution. |
24 | 22 | */ |
25 | | - static private $m_valueclasses = array(); |
| 23 | + static private $m_typelabels; |
26 | 24 | |
27 | 25 | /** |
| 26 | + * Array of ids indexed by type aliases. Used for datatype |
| 27 | + * resolution. |
| 28 | + */ |
| 29 | + static private $m_typealiases; |
| 30 | + |
| 31 | + /** |
| 32 | + * Array of class names for creating new SMWDataValues, indexed by |
| 33 | + * type id. |
| 34 | + */ |
| 35 | + static private $m_typeclasses; |
| 36 | + |
| 37 | + /** |
28 | 38 | * Cache for type specifications (type datavalues), indexed by property name (both without namespace prefix). |
29 | 39 | */ |
30 | | - static private $m_typelabels = array(); |
| 40 | + static private $m_typebyproperty = array(); |
31 | 41 | |
32 | 42 | /** |
33 | 43 | * Create a value from a string supplied by a user for a given property. |
— | — | @@ -35,8 +45,8 @@ |
36 | 46 | */ |
37 | 47 | static public function newPropertyValue($propertyname, $value=false, $caption=false) { |
38 | 48 | wfProfileIn("SMWDataValueFactory::newPropertyValue (SMW)"); |
39 | | - if(array_key_exists($propertyname,SMWDataValueFactory::$m_typelabels)) { // use cache |
40 | | - $result = SMWDataValueFactory::newTypeObjectValue(SMWDataValueFactory::$m_typelabels[$propertyname], $value, $caption, $propertyname); |
| 49 | + if(array_key_exists($propertyname,SMWDataValueFactory::$m_typebyproperty)) { // use cache |
| 50 | + $result = SMWDataValueFactory::newTypeObjectValue(SMWDataValueFactory::$m_typebyproperty[$propertyname], $value, $caption, $propertyname); |
41 | 51 | wfProfileOut("SMWDataValueFactory::newPropertyValue (SMW)"); |
42 | 52 | return $result; |
43 | 53 | } // else: find type for property: |
— | — | @@ -47,7 +57,7 @@ |
48 | 58 | } else { |
49 | 59 | $type = SMWDataValueFactory::newTypeIDValue('__typ'); |
50 | 60 | $type->setXSDValue('_wpg'); |
51 | | - SMWDataValueFactory::$m_typelabels[$propertyname] = $type; |
| 61 | + SMWDataValueFactory::$m_typebyproperty[$propertyname] = $type; |
52 | 62 | $result = SMWDataValueFactory::newTypeIDValue('_wpg',$value,$caption,$propertyname); |
53 | 63 | } |
54 | 64 | wfProfileOut("SMWDataValueFactory::newPropertyValue (SMW)"); |
— | — | @@ -61,19 +71,19 @@ |
62 | 72 | */ |
63 | 73 | static public function newPropertyObjectValue(Title $property, $value=false, $caption=false) { |
64 | 74 | $propertyname = $property->getText(); |
65 | | - if(array_key_exists($propertyname,SMWDataValueFactory::$m_typelabels)) { // use cache |
66 | | - return SMWDataValueFactory::newTypeObjectValue(SMWDataValueFactory::$m_typelabels[$propertyname], $value, $caption, $propertyname); |
| 75 | + if(array_key_exists($propertyname,SMWDataValueFactory::$m_typebyproperty)) { // use cache |
| 76 | + return SMWDataValueFactory::newTypeObjectValue(SMWDataValueFactory::$m_typebyproperty[$propertyname], $value, $caption, $propertyname); |
67 | 77 | } // else: find type for property: |
68 | 78 | |
69 | 79 | $typearray = smwfGetStore()->getSpecialValues($property,SMW_SP_HAS_TYPE); |
70 | 80 | if (count($typearray)==1) { |
71 | | - SMWDataValueFactory::$m_typelabels[$propertyname] = $typearray[0]; |
72 | | - $result = SMWDataValueFactory::newTypeObjectValue(SMWDataValueFactory::$m_typelabels[$propertyname], $value, $caption, $propertyname); |
| 81 | + SMWDataValueFactory::$m_typebyproperty[$propertyname] = $typearray[0]; |
| 82 | + $result = SMWDataValueFactory::newTypeObjectValue(SMWDataValueFactory::$m_typebyproperty[$propertyname], $value, $caption, $propertyname); |
73 | 83 | return $result; |
74 | 84 | } elseif (count($typearray)==0) { |
75 | 85 | $type = SMWDataValueFactory::newTypeIDValue('__typ'); |
76 | 86 | $type->setXSDValue('_wpg'); |
77 | | - SMWDataValueFactory::$m_typelabels[$propertyname] = $type; |
| 87 | + SMWDataValueFactory::$m_typebyproperty[$propertyname] = $type; |
78 | 88 | return SMWDataValueFactory::newTypeIDValue('_wpg',$value,$caption,$propertyname); |
79 | 89 | } else { |
80 | 90 | global $smwgIP; |
— | — | @@ -123,7 +133,8 @@ |
124 | 134 | * @param $propertyname text name of according property, or false (may be relevant for getting further parameters) |
125 | 135 | */ |
126 | 136 | static public function newTypeObjectValue(/*SMWDataValue*/ $typevalue, $value=false, $caption=false, $propertyname=false) { |
127 | | - if (array_key_exists($typevalue->getXSDValue(), SMWDataValueFactory::$m_valueclasses)) { |
| 137 | + SMWDataValueFactory::initDatatypes(); |
| 138 | + if (array_key_exists($typevalue->getXSDValue(), SMWDataValueFactory::$m_typeclasses)) { |
128 | 139 | return SMWDataValueFactory::newTypeIDValue($typevalue->getXSDValue(), $value, $caption, $propertyname); |
129 | 140 | } else { |
130 | 141 | if (!$typevalue->isUnary()) { // n-ary type? |
— | — | @@ -132,7 +143,7 @@ |
133 | 144 | } else { ///TODO migrate to new system |
134 | 145 | global $smwgIP; |
135 | 146 | include_once($smwgIP . '/includes/SMW_OldDataValue.php'); |
136 | | - $type = SMWTypeHandlerFactory::getTypeHandlerByLabel($typevalue->getWikiValue()); |
| 147 | + $type = SMWTypeHandlerFactory::getTypeHandlerByLabel($typevalue->getXSDValue()); |
137 | 148 | $result = new SMWOldDataValue($type); |
138 | 149 | } |
139 | 150 | } |
— | — | @@ -156,20 +167,9 @@ |
157 | 168 | * @param $propertyname text name of according property, or false (may be relevant for getting further parameters) |
158 | 169 | */ |
159 | 170 | static public function newTypeIDValue($typeid, $value=false, $caption=false, $propertyname=false) { |
160 | | - if (array_key_exists($typeid, SMWDataValueFactory::$m_valueclasses)) { |
161 | | - $vc = SMWDataValueFactory::$m_valueclasses[$typeid]; |
162 | | - // check if class file was already included for this class |
163 | | - if ($vc[0] == false) { |
164 | | - global $smwgIP; |
165 | | - if (file_exists($smwgIP . '/includes/SMW_DV_'. $vc[1] . '.php')) { |
166 | | - include_once($smwgIP . '/includes/SMW_DV_'. $vc[1] . '.php'); |
167 | | - } else { // file for registered type missing |
168 | | - include_once($smwgIP . '/includes/SMW_DV_Error.php'); |
169 | | - new SMWErrorValue(wfMsgForContent('smw_unknowntype'), $value, $caption); |
170 | | - } |
171 | | - $vc[0] = true; |
172 | | - } |
173 | | - $result = new $vc[2]($typeid); |
| 171 | + SMWDataValueFactory::initDatatypes(); |
| 172 | + if (array_key_exists($typeid, SMWDataValueFactory::$m_typeclasses)) { |
| 173 | + $result = new SMWDataValueFactory::$m_typeclasses[$typeid]($typeid); |
174 | 174 | } else { |
175 | 175 | $typevalue = SMWDataValueFactory::newTypeIDValue('__typ'); |
176 | 176 | $typevalue->setXSDValue($typeid); |
— | — | @@ -190,9 +190,9 @@ |
191 | 191 | */ |
192 | 192 | static public function getPropertyObjectTypeID(Title $property) { |
193 | 193 | $propertyname = $property->getText(); |
194 | | - if (array_key_exists($propertyname, SMWDataValueFactory::$m_typelabels)) { |
195 | | - if (SMWDataValueFactory::$m_typelabels[$propertyname]->isUnary() ) { |
196 | | - return SMWDataValueFactory::$m_typelabels[$propertyname]->getXSDValue(); |
| 194 | + if (array_key_exists($propertyname, SMWDataValueFactory::$m_typebyproperty)) { |
| 195 | + if (SMWDataValueFactory::$m_typebyproperty[$propertyname]->isUnary() ) { |
| 196 | + return SMWDataValueFactory::$m_typebyproperty[$propertyname]->getXSDValue(); |
197 | 197 | } else { |
198 | 198 | return '__nry'; |
199 | 199 | } |
— | — | @@ -208,68 +208,124 @@ |
209 | 209 | static public function getPropertyObjectTypeValue(Title $property) { |
210 | 210 | $propertyname = $property->getText(); |
211 | 211 | SMWDataValueFactory::newPropertyObjectValue($property); |
212 | | - if (array_key_exists($propertyname, SMWDataValueFactory::$m_typelabels)) { |
213 | | - return SMWDataValueFactory::$m_typelabels[$propertyname]; |
| 212 | + if (array_key_exists($propertyname, SMWDataValueFactory::$m_typebyproperty)) { |
| 213 | + return SMWDataValueFactory::$m_typebyproperty[$propertyname]; |
214 | 214 | } else { // no type found |
215 | 215 | return NULL; |
216 | 216 | } |
217 | 217 | } |
218 | 218 | |
219 | 219 | /** |
220 | | - * Create a value from a user-supplied string for which a type handler is known |
221 | | - * If no value is given, an empty container is created, the value of which |
222 | | - * can be set later on. |
223 | | - * |
| 220 | + * Register a new SMWDataValue class for dealing with some type. Will be included and |
| 221 | + * instantiated dynamically if needed. |
224 | 222 | * @DEPRECATED |
225 | 223 | */ |
226 | | - static public function newTypeHandlerValue(SMWTypeHandler $type, $value=false) { |
227 | | - global $smwgIP; |
228 | | - include_once($smwgIP . '/includes/SMW_OldDataValue.php'); |
229 | | - $result = new SMWOldDataValue($type); |
230 | | - if ($value !== false) { |
231 | | - $result->setUserValue($value); |
| 224 | + static public function registerDataValueClass($typestring, $filepart, $classname) { |
| 225 | + SMWDataValueFactory::initDatatypes(); |
| 226 | + SMWDataValueFactory::$m_typeclasses[$typestring] = $classname; |
| 227 | + } |
| 228 | + |
| 229 | + /** |
| 230 | + * Gather all available datatypes and label<=>id<=>datatype associations. This method |
| 231 | + * is called before most methods of this factory. |
| 232 | + */ |
| 233 | + static protected function initDatatypes() { |
| 234 | + if (is_array(SMWDataValueFactory::$m_typelabels)) { |
| 235 | + return; //init happened before |
232 | 236 | } |
233 | | - return $result; |
| 237 | + |
| 238 | + global $smwgContLang, $smwgIP, $wgAutoloadClasses; |
| 239 | + SMWDataValueFactory::$m_typelabels = $smwgContLang->getDatatypeLabels(); |
| 240 | + SMWDataValueFactory::$m_typealiases = $smwgContLang->getDatatypeAliases(); |
| 241 | + // Setup built-in datatypes. |
| 242 | + // NOTE: all ids must start with underscores, where two underscores indicate |
| 243 | + // truly internal (non user-acessible types). All others should also get a |
| 244 | + // translation in the language files, or they won't be available for users. |
| 245 | + $wgAutoloadClasses['SMWStringValue'] = $smwgIP . '/includes/SMW_DV_String.php'; |
| 246 | + $wgAutoloadClasses['SMWWikiPageValue'] = $smwgIP . '/includes/SMW_DV_WikiPage.php'; |
| 247 | + $wgAutoloadClasses['SMWURIValue'] = $smwgIP . '/includes/SMW_DV_URI.php'; |
| 248 | + $wgAutoloadClasses['SMWTypesValue'] = $smwgIP . '/includes/SMW_DV_Types.php'; |
| 249 | + $wgAutoloadClasses['SMWNAryValue'] = $smwgIP . '/includes/SMW_DV_NAry.php'; |
| 250 | + $wgAutoloadClasses['SMWErrorValue'] = $smwgIP . '/includes/SMW_DV_Error.php'; |
| 251 | + SMWDataValueFactory::$m_typeclasses = array( |
| 252 | + '_txt' => 'SMWStringValue', |
| 253 | + '_str' => 'SMWStringValue', |
| 254 | +// '_ema' => 'SMWURIValue', |
| 255 | +// '_uri' => 'SMWURIValue', |
| 256 | +// '_url' => 'SMWURIValue', |
| 257 | +// '_anu' => 'SMWURIValue', |
| 258 | + '_wpg' => 'SMWWikiPageValue', |
| 259 | + '__typ' => 'SMWTypesValue', |
| 260 | + '__nry' => 'SMWNAryValue', |
| 261 | + '__err' => 'SMWErrorValue' |
| 262 | + ); |
| 263 | + |
| 264 | + wfRunHooks( 'smwInitDatatypes' ); |
234 | 265 | } |
235 | 266 | |
236 | 267 | /** |
237 | | - * @DEPRECATED |
| 268 | + * A function for registering/overwriting datatypes for SMW. Should be called from |
| 269 | + * within the hook 'smwInitDatatypes'. |
238 | 270 | */ |
239 | | - static public function newAttributeValue($property, $value=false, $caption=false) { |
240 | | - trigger_error("Function newAttributeValue is deprecated. Use new property methods.", E_USER_NOTICE); |
241 | | - return SMWDataValueFactory::newPropertyValue($property, $value, $caption); |
| 271 | + static function registerDatatype($id, $classname, $label='') { |
| 272 | + SMWDataValueFactory::$m_typeclasses[$id] = $classname; |
| 273 | + if ($label != '') { |
| 274 | + SMWDataValueFactory::$m_typelabels[$id] = $label; |
| 275 | + } |
242 | 276 | } |
243 | 277 | |
244 | 278 | /** |
245 | | - * @DEPRECATED |
| 279 | + * Look up the ID that identifies the datatype of the given label internally. |
| 280 | + * This id is used for all internal operations. Compound types are not supported |
| 281 | + * by this method (decomposition happens earlier). Custom types get their DBkeyed |
| 282 | + * label as id. All ids are prefixed by an underscore in order to distinguish them |
| 283 | + * from custom types. |
| 284 | + * |
| 285 | + * This method may or may not take aliases into account. For unknown labels, the |
| 286 | + * normalised (DB-version) label is used as an ID. |
246 | 287 | */ |
247 | | - static public function newAttributeObjectValue(Title $property, $value=false, $caption=false) { |
248 | | - trigger_error("Function newAttributeObjectValue is deprecated. Use new property methods.", E_USER_NOTICE); |
249 | | - return SMWDataValueFactory::newPropertyObjectValue($property, $value, $caption); |
| 288 | + static public function findTypeID($label, $useAlias = true) { |
| 289 | + SMWDataValueFactory::initDatatypes(); |
| 290 | + $id = array_search($label, SMWDataValueFactory::$m_typelabels); |
| 291 | + if ($id !== false) { |
| 292 | + return $id; |
| 293 | + } elseif (array_key_exists($label, SMWDataValueFactory::$m_typealiases)) { |
| 294 | + return SMWDataValueFactory::$m_typealiases[$label]; |
| 295 | + } else { |
| 296 | + return str_replace(' ', '_', $label); |
| 297 | + } |
250 | 298 | } |
251 | 299 | |
| 300 | + /** |
| 301 | + * Get the translated user label for a given internal ID. If the ID does |
| 302 | + * not have a label associated with it in the current language, the ID itself |
| 303 | + * is transformed into a label (appropriate for user defined types). |
| 304 | + */ |
| 305 | + static public function findTypeLabel($id) { |
| 306 | + SMWDataValueFactory::initDatatypes(); |
| 307 | + if ($id{0} === '_') { |
| 308 | + if (array_key_exists($id, SMWDataValueFactory::$m_typelabels)) { |
| 309 | + return SMWDataValueFactory::$m_typelabels[$id]; |
| 310 | + } else { //internal type without translation to user space; |
| 311 | + //might also happen for historic types after upgrade -- |
| 312 | + //alas, we have no idea what the former label would have been |
| 313 | + return str_replace('_', ' ', $id); |
| 314 | + } |
| 315 | + } else { // non-builtin type, use id as label |
| 316 | + return str_replace('_', ' ', $id); |
| 317 | + } |
| 318 | + } |
252 | 319 | |
253 | 320 | /** |
254 | | - * Register a new SMWDataValue class for dealing with some type. Will be included and |
255 | | - * instantiated dynamically if needed. |
| 321 | + * Return an array of all labels that a user might specify as the type of |
| 322 | + * a property, and that are internal (i.e. not user defined). No labels are |
| 323 | + * returned for internal types without user labels (e.g. the special types for |
| 324 | + * some special properties), and for user defined types. |
256 | 325 | */ |
257 | | - static public function registerDataValueClass($typestring, $filepart, $classname) { |
258 | | - SMWDataValueFactory::$m_valueclasses[$typestring] = array(false,$filepart,$classname); |
| 326 | + static public function getKnownTypeLabels() { |
| 327 | + SMWDataValueFactory::initDatatypes(); |
| 328 | + return SMWDataValueFactory::$m_typelabels; |
259 | 329 | } |
260 | 330 | |
261 | 331 | } |
262 | 332 | |
263 | | -/// NOTE: the type constants are registered to translated labels in SMW_TypeValue.php. |
264 | | -/// However, types that are not available to users can also have ids for being registered here, but |
265 | | -/// these ids should start with two underscores. |
266 | | -SMWDataValueFactory::registerDataValueClass('_txt','String','SMWStringValue'); |
267 | | -SMWDataValueFactory::registerDataValueClass('_str','String','SMWStringValue'); |
268 | | -// SMWDataValueFactory::registerDataValueClass('ema','URI','SMWURIValue'); |
269 | | -// SMWDataValueFactory::registerDataValueClass('uri','URI','SMWURIValue'); |
270 | | -// SMWDataValueFactory::registerDataValueClass('url','URI','SMWURIValue'); |
271 | | -// SMWDataValueFactory::registerDataValueClass('anu','URI','SMWURIValue'); |
272 | | -SMWDataValueFactory::registerDataValueClass('_wpg','WikiPage','SMWWikiPageValue'); |
273 | | - |
274 | | -SMWDataValueFactory::registerDataValueClass('__typ','Types','SMWTypesValue'); |
275 | | -SMWDataValueFactory::registerDataValueClass('__nry','NAry','SMWNAryValue'); |
276 | | -SMWDataValueFactory::registerDataValueClass('__err','Error','SMWErrorValue'); |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_NAry.php |
— | — | @@ -286,7 +286,7 @@ |
287 | 287 | $typelabels = $this->m_type->getTypeLabels(); |
288 | 288 | for ($i = 0; $i < $this->m_count; $i++) { |
289 | 289 | if ( ($i < count($datavalues) ) && ($datavalues[$i] !== NULL) ) { |
290 | | - //&& ($datavalues[$i]->getTypeID() == SMWTypesValue::findTypeID($typelabels[$i])) ) { |
| 290 | + //&& ($datavalues[$i]->getTypeID() == SMWDataValueFactory::findTypeID($typelabels[$i])) ) { |
291 | 291 | ///TODO: is the above typcheck required, or can we assume responsible callers? |
292 | 292 | $this->m_values[$i] = $datavalues[$i]; |
293 | 293 | } else { |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DT_Boolean.php |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | class SMWBooleanTypeHandler implements SMWTypeHandler { |
13 | 13 | |
14 | 14 | function getID() { |
15 | | - return 'boolean'; |
| 15 | + return '_boo'; |
16 | 16 | } |
17 | 17 | |
18 | 18 | function getXSDType() { |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DT_GeoCoords.php |
— | — | @@ -51,7 +51,7 @@ |
52 | 52 | } |
53 | 53 | |
54 | 54 | function getID() { |
55 | | - return 'geocoords'; |
| 55 | + return '_geo'; |
56 | 56 | } |
57 | 57 | |
58 | 58 | function getXSDType() { |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_Datatype.php |
— | — | @@ -59,7 +59,6 @@ |
60 | 60 | |
61 | 61 | static private $typeHandlersByLabel = Array(); |
62 | 62 | static private $typeHandlersByAttribute = Array(); |
63 | | - static private $typeLabelsByID = Array(); |
64 | 63 | static private $desiredUnitsByAttribute = Array(); |
65 | 64 | static private $possibleValuesByAttribute = Array(); |
66 | 65 | static private $serviceLinksByAttribute = Array(); |
— | — | @@ -71,7 +70,6 @@ |
72 | 71 | */ |
73 | 72 | static function registerTypeHandler($label, $th) { |
74 | 73 | SMWTypeHandlerFactory::$typeHandlersByLabel[$label] = $th; |
75 | | - SMWTypeHandlerFactory::$typeLabelsByID[$th->getID()] = $label; |
76 | 74 | } |
77 | 75 | |
78 | 76 | /** |
— | — | @@ -82,19 +80,9 @@ |
83 | 81 | */ |
84 | 82 | static function announceTypeHandler($label, $id, $filepart, $class, $param = NULL) { |
85 | 83 | SMWTypeHandlerFactory::$typeHandlersByLabel[$label] = array($filepart, $class, $param); |
86 | | - SMWTypeHandlerFactory::$typeLabelsByID[$id] = $label; |
87 | 84 | } |
88 | 85 | |
89 | 86 | /** |
90 | | - * This method returns an array of the labels of built-in types (those |
91 | | - * announced in code rather than user-defined types with custom units). |
92 | | - * Needed since typeHandlersByLabel is private. |
93 | | - */ |
94 | | - static function getTypeLabels() { |
95 | | - return array_keys(SMWTypeHandlerFactory::$typeHandlersByLabel); |
96 | | - } |
97 | | - |
98 | | - /** |
99 | 87 | * This method returns the type handler object for a given type label |
100 | 88 | * (i.e. a localized type name), or an error type handler if the label |
101 | 89 | * is not associated with some handler. The label is usually the article |
— | — | @@ -120,7 +108,7 @@ |
121 | 109 | if (!$findConversions) return NULL; |
122 | 110 | $conversionFactors = SMWTypeHandlerFactory::getConversionFactors($typelabel); |
123 | 111 | if (count($conversionFactors) !== 0) { |
124 | | - $instance = new SMWLinearTypeHandler('Type:' . $typelabel, $conversionFactors); // no localisation needed -- "Type:" is just a disamb. string in the DB |
| 112 | + $instance = new SMWLinearTypeHandler($typelabel, $conversionFactors); |
125 | 113 | SMWTypeHandlerFactory::$typeHandlersByLabel[$typelabel] = $instance; |
126 | 114 | return SMWTypeHandlerFactory::$typeHandlersByLabel[$typelabel]; |
127 | 115 | } |
— | — | @@ -239,23 +227,23 @@ |
240 | 228 | * then you must add it to this list! |
241 | 229 | */ |
242 | 230 | // Integer |
243 | | -SMWTypeHandlerFactory::announceTypeHandler($smwgContLang->getDatatypeLabel('smw_int'),'int','Integer','SMWIntegerTypeHandler'); |
| 231 | +SMWTypeHandlerFactory::announceTypeHandler('_int','int','Integer','SMWIntegerTypeHandler'); |
244 | 232 | // URLs etc. |
245 | | -SMWTypeHandlerFactory::announceTypeHandler($smwgContLang->getDatatypeLabel('smw_email'),'email','URI','SMWURITypeHandler','email'); |
246 | | -SMWTypeHandlerFactory::announceTypeHandler($smwgContLang->getDatatypeLabel('smw_url'),'url','URI','SMWURITypeHandler','url'); |
247 | | -SMWTypeHandlerFactory::announceTypeHandler($smwgContLang->getDatatypeLabel('smw_uri'),'uri','URI','SMWURITypeHandler','uri'); |
248 | | -SMWTypeHandlerFactory::announceTypeHandler($smwgContLang->getDatatypeLabel('smw_annouri'),'annouri','URI','SMWURITypeHandler','annouri'); |
| 233 | +SMWTypeHandlerFactory::announceTypeHandler('_ema','email','URI','SMWURITypeHandler','email'); |
| 234 | +SMWTypeHandlerFactory::announceTypeHandler('_url','url','URI','SMWURITypeHandler','url'); |
| 235 | +SMWTypeHandlerFactory::announceTypeHandler('_uri','uri','URI','SMWURITypeHandler','uri'); |
| 236 | +SMWTypeHandlerFactory::announceTypeHandler('_ari','annouri','URI','SMWURITypeHandler','annouri'); |
249 | 237 | // Dates & times |
250 | | -SMWTypeHandlerFactory::announceTypeHandler($smwgContLang->getDatatypeLabel('smw_datetime'),'datetime','DateTime','SMWDateTimeTypeHandler'); |
| 238 | +SMWTypeHandlerFactory::announceTypeHandler('_dat','datetime','DateTime','SMWDateTimeTypeHandler'); |
251 | 239 | // Geographic coordinates |
252 | | -SMWTypeHandlerFactory::announceTypeHandler($smwgContLang->getDatatypeLabel('smw_geocoordinate'),'geocoords','GeoCoords','SMWGeographicLocationTypeHandler'); |
| 240 | +SMWTypeHandlerFactory::announceTypeHandler('_geo','geocoords','GeoCoords','SMWGeographicLocationTypeHandler'); |
253 | 241 | // Enums |
254 | | -SMWTypeHandlerFactory::announceTypeHandler($smwgContLang->getDatatypeLabel('smw_enum'),'enum','Enum','SMWEnumTypeHandler'); |
| 242 | +SMWTypeHandlerFactory::announceTypeHandler('_enu','enum','Enum','SMWEnumTypeHandler'); |
255 | 243 | // Text |
256 | | -SMWTypeHandlerFactory::announceTypeHandler($smwgContLang->getDatatypeLabel('smw_text'),'text','Text','SMWTextTypeHandler'); |
| 244 | +//SMWTypeHandlerFactory::announceTypeHandler('_txt','text','Text','SMWTextTypeHandler'); |
257 | 245 | // Bools |
258 | 246 | // Booleans can (and more problematic: will) be modelled by two-valued enums; too much choice yields confusion (note that Categories are also addressing a simliar modelling problem already -- let's not introduce three ways of encoding this) |
259 | | -//SMWTypeHandlerFactory::announceTypeHandler($smwgContLang->getDatatypeLabel('smw_bool'),'bool','Boolean','SMWBooleanTypeHandler'); |
| 247 | +//SMWTypeHandlerFactory::announceTypeHandler('_boo'),'bool','Boolean','SMWBooleanTypeHandler'); |
260 | 248 | |
261 | 249 | /*********************************************************************/ |
262 | 250 | /* Basic typehandler classes */ |
— | — | @@ -369,53 +357,53 @@ |
370 | 358 | /** |
371 | 359 | * Class for managing string types. Very simple. |
372 | 360 | */ |
373 | | -class SMWStringTypeHandler implements SMWTypeHandler { |
| 361 | +// class SMWStringTypeHandler implements SMWTypeHandler { |
| 362 | +// |
| 363 | +// function getID() { |
| 364 | +// return 'string'; |
| 365 | +// } |
| 366 | +// |
| 367 | +// function getXSDType() { |
| 368 | +// return 'http://www.w3.org/2001/XMLSchema#string'; |
| 369 | +// } |
| 370 | +// |
| 371 | +// function getUnits() { //no units for strings |
| 372 | +// return array('STDUNIT'=>false, 'ALLUNITS'=>array()); |
| 373 | +// } |
| 374 | +// |
| 375 | +// function processValue($value,&$datavalue) { |
| 376 | +// if ($value!='') { //do not accept empty strings |
| 377 | +// $xsdvalue = smwfXMLContentEncode($value); |
| 378 | +// // 255 below matches smw_attributes.value_xsd definition in smwfMakeSemanticTables() |
| 379 | +// // Note that depending on database encoding and UTF-8 settings, longer or |
| 380 | +// // shorter strings than this with int'l characters may exceed database field. |
| 381 | +// if (strlen($xsdvalue) > 255) { |
| 382 | +// $datavalue->setError(wfMsgForContent('smw_maxstring', $xsdvalue)); |
| 383 | +// } else { |
| 384 | +// $datavalue->setProcessedValues($value, $xsdvalue); |
| 385 | +// $datavalue->setPrintoutString($value); |
| 386 | +// $datavalue->addQuicksearchLink(); |
| 387 | +// // TODO: Performance: this causes a SpecialProperties database query and some callers don't use it. |
| 388 | +// $datavalue->addServiceLinks(urlencode($value)); |
| 389 | +// } |
| 390 | +// } else { |
| 391 | +// $datavalue->setError(wfMsgForContent('smw_emptystring')); |
| 392 | +// } |
| 393 | +// return true; |
| 394 | +// } |
| 395 | +// |
| 396 | +// function processXSDValue($value,$unit,&$datavalue) { |
| 397 | +// return $this->processValue($value,$datavalue); |
| 398 | +// } |
| 399 | +// |
| 400 | +// function isNumeric() { |
| 401 | +// return false; |
| 402 | +// } |
| 403 | +// } |
| 404 | +// |
| 405 | +// SMWTypeHandlerFactory::registerTypeHandler('_str'), |
| 406 | +// new SMWStringTypeHandler()); |
374 | 407 | |
375 | | - function getID() { |
376 | | - return 'string'; |
377 | | - } |
378 | | - |
379 | | - function getXSDType() { |
380 | | - return 'http://www.w3.org/2001/XMLSchema#string'; |
381 | | - } |
382 | | - |
383 | | - function getUnits() { //no units for strings |
384 | | - return array('STDUNIT'=>false, 'ALLUNITS'=>array()); |
385 | | - } |
386 | | - |
387 | | - function processValue($value,&$datavalue) { |
388 | | - if ($value!='') { //do not accept empty strings |
389 | | - $xsdvalue = smwfXMLContentEncode($value); |
390 | | - // 255 below matches smw_attributes.value_xsd definition in smwfMakeSemanticTables() |
391 | | - // Note that depending on database encoding and UTF-8 settings, longer or |
392 | | - // shorter strings than this with int'l characters may exceed database field. |
393 | | - if (strlen($xsdvalue) > 255) { |
394 | | - $datavalue->setError(wfMsgForContent('smw_maxstring', $xsdvalue)); |
395 | | - } else { |
396 | | - $datavalue->setProcessedValues($value, $xsdvalue); |
397 | | - $datavalue->setPrintoutString($value); |
398 | | - $datavalue->addQuicksearchLink(); |
399 | | - // TODO: Performance: this causes a SpecialProperties database query and some callers don't use it. |
400 | | - $datavalue->addServiceLinks(urlencode($value)); |
401 | | - } |
402 | | - } else { |
403 | | - $datavalue->setError(wfMsgForContent('smw_emptystring')); |
404 | | - } |
405 | | - return true; |
406 | | - } |
407 | | - |
408 | | - function processXSDValue($value,$unit,&$datavalue) { |
409 | | - return $this->processValue($value,$datavalue); |
410 | | - } |
411 | | - |
412 | | - function isNumeric() { |
413 | | - return false; |
414 | | - } |
415 | | -} |
416 | | - |
417 | | -SMWTypeHandlerFactory::registerTypeHandler($smwgContLang->getDatatypeLabel('smw_string'), |
418 | | - new SMWStringTypeHandler()); |
419 | | - |
420 | 408 | /** |
421 | 409 | * This method formats a float number value according to the given |
422 | 410 | * language and precision settings, with some intelligence to |
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageEs.php |
— | — | @@ -187,23 +187,37 @@ |
188 | 188 | 'smw_result_noresults' => 'Lo siento, no hay resultados.' |
189 | 189 | ); |
190 | 190 | |
191 | | -protected $smwDatatypeLabels = array( |
192 | | - 'smw_wikipage' => 'Page', // name of page datatype //TODO translate |
193 | | - 'smw_string' => 'Cadena de caracteres', // name of the string type |
194 | | - 'smw_text' => 'Texto', // name of the text type (very long strings) |
195 | | - 'smw_enum' => 'Enumeración', // name of the enum type |
196 | | - 'smw_bool' => 'Booleano', // name of the boolean type |
197 | | - 'smw_int' => 'Número entero', // name of the int type |
198 | | - 'smw_float' => 'Número con coma', // name of the floating point type |
199 | | - 'smw_geocoordinate' => 'Coordenadas geográficas', // name of the geocoord type |
200 | | - 'smw_temperature' => 'Temperatura', // name of the temperature type |
201 | | - 'smw_datetime' => 'Fecha', // name of the datetime (calendar) type |
202 | | - 'smw_email' => 'Dirección electrónica', // name of the email (URI) type |
203 | | - 'smw_url' => 'URL', // name of the URL type (string datatype property) |
204 | | - 'smw_uri' => 'URI', // name of the URI type (object property) |
205 | | - 'smw_annouri' => 'Anotación-URI' // name of the annotation URI type (annotation property) |
| 191 | +protected $m_DatatypeLabels = array( |
| 192 | + '_wpg' => 'Page', // name of page datatype //TODO translate |
| 193 | + '_str' => 'Cadena de caracteres', // name of the string type |
| 194 | + '_txt' => 'Texto', // name of the text type (very long strings) |
| 195 | + '_enu' => 'Enumeración', // name of the enum type |
| 196 | + //'_boo' => 'Booleano', // name of the boolean type |
| 197 | + '_int' => 'Número entero', // name of the int type |
| 198 | + '_flt' => 'Número con coma', // name of the floating point type |
| 199 | + '_geo' => 'Coordenadas geográficas', // name of the geocoord type |
| 200 | + '_tem' => 'Temperatura', // name of the temperature type |
| 201 | + '_dat' => 'Fecha', // name of the datetime (calendar) type |
| 202 | + '_ema' => 'Dirección electrónica', // name of the email (URI) type |
| 203 | + '_url' => 'URL', // name of the URL type (string datatype property) |
| 204 | + '_uri' => 'URI', // name of the URI type (object property) |
| 205 | + '_anu' => 'Anotación-URI' // name of the annotation URI type (annotation property) |
206 | 206 | ); |
207 | 207 | |
| 208 | +protected $m_DatatypeAliases = array( |
| 209 | + // support English aliases: |
| 210 | + 'Page' => '_wpg', |
| 211 | + 'String' => '_str', |
| 212 | + 'Text' => '_txt', |
| 213 | + 'Integer' => '_int', |
| 214 | + 'Float' => '_flt', |
| 215 | + 'Geographic coordinate' => '_geo', |
| 216 | + 'Temperature' => '_tem', |
| 217 | + 'Date' => '_dat', |
| 218 | + 'Email' => '_ema', |
| 219 | + 'Annotation URI' => '_anu' |
| 220 | +); |
| 221 | + |
208 | 222 | protected $smwSpecialProperties = array( |
209 | 223 | //always start upper-case |
210 | 224 | SMW_SP_HAS_TYPE => 'Tiene tipo de datos', |
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageFr.php |
— | — | @@ -188,23 +188,37 @@ |
189 | 189 | 'smw_result_noresults' => 'Désolé, aucun résultat.', |
190 | 190 | ); |
191 | 191 | |
192 | | -protected $smwDatatypeLabels = array( |
193 | | - 'smw_wikipage' => 'Page', // name of page datatype //TODO translate |
194 | | - 'smw_string' => 'Chaîne de caractères', // name of the string type |
195 | | - 'smw_text' => 'Text', // name of the text type (very long strings) //TODO: translate |
196 | | - 'smw_enum' => 'Énumeration', // name of the enum type |
197 | | - 'smw_bool' => 'Booléen', // name of the boolean type |
198 | | - 'smw_int' => 'Nombre entier', // name of the int type |
199 | | - 'smw_float' => 'Nombre décimal', // name of the floating point type |
200 | | - 'smw_geocoordinate' => 'Coordonnées géographiques', // name of the geocoord type |
201 | | - 'smw_temperature' => 'Température', // name of the temperature type |
202 | | - 'smw_datetime' => 'Date', // name of the datetime (calendar) type |
203 | | - 'smw_email' => 'Adresse électronique', // name of the email (URI) type |
204 | | - 'smw_url' => 'URL', // name of the URL type (string datatype property) |
205 | | - 'smw_uri' => 'URI', // name of the URI type (object property) |
206 | | - 'smw_annouri' => 'Annotation-URI' // name of the annotation URI type (annotation property) |
| 192 | +protected $m_DatatypeLabels = array( |
| 193 | + '_wpg' => 'Page', // name of page datatype //TODO translate |
| 194 | + '_str' => 'Chaîne de caractères', // name of the string type |
| 195 | + '_txt' => 'Text', // name of the text type (very long strings) //TODO: translate |
| 196 | + '_enu' => 'Énumeration', // name of the enum type |
| 197 | + //'_boo' => 'Booléen', // name of the boolean type |
| 198 | + '_int' => 'Nombre entier', // name of the int type |
| 199 | + '_flt' => 'Nombre décimal', // name of the floating point type |
| 200 | + '_geo' => 'Coordonnées géographiques', // name of the geocoord type |
| 201 | + '_tem' => 'Température', // name of the temperature type |
| 202 | + '_dat' => 'Date', // name of the datetime (calendar) type |
| 203 | + '_ema' => 'Adresse électronique', // name of the email (URI) type |
| 204 | + '_url' => 'URL', // name of the URL type (string datatype property) |
| 205 | + '_uri' => 'URI', // name of the URI type (object property) |
| 206 | + '_anu' => 'Annotation-URI' // name of the annotation URI type (annotation property) |
207 | 207 | ); |
208 | 208 | |
| 209 | +protected $m_DatatypeAliases = array( |
| 210 | + // support English aliases: |
| 211 | + 'Page' => '_wpg', |
| 212 | + 'String' => '_str', |
| 213 | + 'Text' => '_txt', |
| 214 | + 'Integer' => '_int', |
| 215 | + 'Float' => '_flt', |
| 216 | + 'Geographic coordinate' => '_geo', |
| 217 | + 'Temperature' => '_tem', |
| 218 | + 'Date' => '_dat', |
| 219 | + 'Email' => '_ema', |
| 220 | + 'Annotation URI' => '_anu' |
| 221 | +); |
| 222 | + |
209 | 223 | protected $smwSpecialProperties = array( |
210 | 224 | //always start upper-case |
211 | 225 | SMW_SP_HAS_TYPE => 'A le type', |
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageDe.php |
— | — | @@ -177,30 +177,43 @@ |
178 | 178 | 'smw_result_noresults' => 'Keine Ergebnisse gefunden.' |
179 | 179 | ); |
180 | 180 | |
181 | | -protected $smwDatatypeLabels = array( |
182 | | - 'smw_wikipage' => 'Seite', // name of page datatype |
183 | | - 'smw_string' => 'Zeichenkette', // name of the string type |
184 | | - 'smw_text' => 'Text', // name of the text type |
185 | | - 'smw_enum' => 'Aufzählung', // name of the enum type |
186 | | - 'smw_bool' => 'Wahrheitswert', // name of the boolean type |
187 | | - 'smw_int' => 'Ganze Zahl', // name of the int type |
188 | | - 'smw_float' => 'Dezimalzahl', // name of the floating point type |
189 | | - 'smw_geocoordinate' => 'Geografische Koordinaten', // name of the geocoord type |
190 | | - 'smw_temperature' => 'Temperatur', // name of the temperature type |
191 | | - 'smw_datetime' => 'Datum', // name of the datetime (calendar) type |
192 | | - 'smw_email' => 'Email', // name of the email (URI) type |
193 | | - 'smw_url' => 'URL', // name of the URL type (string datatype property) |
194 | | - 'smw_uri' => 'URI', // name of the URI type (object property) |
195 | | - 'smw_annouri' => 'URI-Annotation' // name of the annotation URI type (annotation property) |
| 181 | +protected $m_DatatypeLabels = array( |
| 182 | + '_wpg' => 'Seite', // name of page datatype |
| 183 | + '_str' => 'Zeichenkette', // name of the string type |
| 184 | + '_txt' => 'Text', // name of the text type |
| 185 | + '_enu' => 'Aufzählung', // name of the enum type |
| 186 | + //'_boo' => 'Wahrheitswert', // name of the boolean type |
| 187 | + '_int' => 'Ganze Zahl', // name of the int type |
| 188 | + '_flt' => 'Dezimalzahl', // name of the floating point type |
| 189 | + '_geo' => 'Geografische Koordinaten', // name of the geocoord type |
| 190 | + '_tem' => 'Temperatur', // name of the temperature type |
| 191 | + '_dat' => 'Datum', // name of the datetime (calendar) type |
| 192 | + '_ema' => 'Email', // name of the email (URI) type |
| 193 | + '_url' => 'URL', // name of the URL type (string datatype property) |
| 194 | + '_uri' => 'URI', // name of the URI type (object property) |
| 195 | + '_anu' => 'URI-Annotation' // name of the annotation URI type (annotation property) |
196 | 196 | ); |
197 | 197 | |
| 198 | +protected $m_DatatypeAliases = array( |
| 199 | + // support English aliases: |
| 200 | + 'Page' => '_wpg', |
| 201 | + 'String' => '_str', |
| 202 | + 'Text' => '_txt', |
| 203 | + 'Integer' => '_int', |
| 204 | + 'Float' => '_flt', |
| 205 | + 'Geographic coordinate' => '_geo', |
| 206 | + 'Temperature' => '_tem', |
| 207 | + 'Date' => '_dat', |
| 208 | + 'Email' => '_ema', |
| 209 | + 'Annotation URI' => '_anu' |
| 210 | +); |
| 211 | + |
198 | 212 | protected $smwSpecialProperties = array( |
199 | 213 | //always start upper-case |
200 | 214 | SMW_SP_HAS_TYPE => 'Hat Datentyp', |
201 | 215 | SMW_SP_HAS_URI => 'Gleichwertige URI', |
202 | 216 | SMW_SP_SUBPROPERTY_OF => 'Untereigenschaft von', |
203 | 217 | SMW_SP_MAIN_DISPLAY_UNIT => 'Erste Ausgabeeinheit', |
204 | | - // SMW_SP_MAIN_DISPLAY_UNIT => 'Primärmaßeinheit für Schirmanzeige', // Great! We really should keep this wonderful translation here! Still, I am not fully certain about my versions either. -- mak |
205 | 218 | SMW_SP_DISPLAY_UNIT => 'Ausgabeeinheit', |
206 | 219 | SMW_SP_IMPORTED_FROM => 'Importiert aus', |
207 | 220 | SMW_SP_CONVERSION_FACTOR => 'Entspricht', |
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageNl.php |
— | — | @@ -173,23 +173,37 @@ |
174 | 174 | 'smw_result_noresults' => 'Sorry, geen resultaten.' |
175 | 175 | ); |
176 | 176 | |
177 | | -protected $smwDatatypeLabels = array( |
178 | | - 'smw_wikipage' => 'Pagina', // name of page datatype |
179 | | - 'smw_string' => 'String', // name of the string type |
180 | | - 'smw_text' => 'Tekst', // name of the text type |
181 | | - 'smw_enum' => 'Opsomming', // name of the enum type |
182 | | - 'smw_bool' => 'Booleans', // name of the boolean type |
183 | | - 'smw_int' => 'Integer', // name of the int type |
184 | | - 'smw_float' => 'Float', // name of the floating point type |
185 | | - 'smw_geocoordinate' => 'Geographische coordinaat', // name of the geocoord type |
186 | | - 'smw_temperature' => 'Temperatuur', // name of the temperature type |
187 | | - 'smw_datetime' => 'Datum', // name of the datetime (calendar) type |
188 | | - 'smw_email' => 'E-mail', // name of the email (URI) type |
189 | | - 'smw_url' => 'URL', // name of the URL type (string datatype property) |
190 | | - 'smw_uri' => 'URI', // name of the URI type (object property) |
191 | | - 'smw_annouri' => 'Annotatie URI' // name of the annotation URI type (annotation property) |
| 177 | +protected $m_DatatypeLabels = array( |
| 178 | + '_wpg' => 'Pagina', // name of page datatype |
| 179 | + '_str' => 'String', // name of the string type |
| 180 | + '_txt' => 'Tekst', // name of the text type |
| 181 | + '_enu' => 'Opsomming', // name of the enum type |
| 182 | + '_boo' => 'Booleans', // name of the boolean type |
| 183 | + '_int' => 'Integer', // name of the int type |
| 184 | + '_flt' => 'Float', // name of the floating point type |
| 185 | + '_geo' => 'Geographische coordinaat', // name of the geocoord type |
| 186 | + '_tem' => 'Temperatuur', // name of the temperature type |
| 187 | + '_dat' => 'Datum', // name of the datetime (calendar) type |
| 188 | + '_ema' => 'E-mail', // name of the email (URI) type |
| 189 | + '_url' => 'URL', // name of the URL type (string datatype property) |
| 190 | + '_uri' => 'URI', // name of the URI type (object property) |
| 191 | + '_anu' => 'Annotatie URI' // name of the annotation URI type (annotation property) |
192 | 192 | ); |
193 | 193 | |
| 194 | +protected $m_DatatypeAliases = array( |
| 195 | + // support English aliases: |
| 196 | + 'Page' => '_wpg', |
| 197 | + 'String' => '_str', |
| 198 | + 'Text' => '_txt', |
| 199 | + 'Integer' => '_int', |
| 200 | + 'Float' => '_flt', |
| 201 | + 'Geographic coordinate' => '_geo', |
| 202 | + 'Temperature' => '_tem', |
| 203 | + 'Date' => '_dat', |
| 204 | + 'Email' => '_ema', |
| 205 | + 'Annotation URI' => '_anu' |
| 206 | +); |
| 207 | + |
194 | 208 | protected $smwSpecialProperties = array( |
195 | 209 | //always start upper-case |
196 | 210 | SMW_SP_HAS_TYPE => 'Heeft type', |
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_LanguagePl.php |
— | — | @@ -219,23 +219,37 @@ |
220 | 220 | 'smw_result_noresults' => 'Niestety, brak wyników.' |
221 | 221 | ); |
222 | 222 | |
223 | | -protected $smwDatatypeLabels = array( |
224 | | - 'smw_wikipage' => 'Page', // name of page datatype //TODO translate |
225 | | - 'smw_string' => 'Łańcuch znaków', // name of the string type |
226 | | - 'smw_text' => 'Text', // name of the text type (very long strings) //TODO: translate |
227 | | - 'smw_enum' => 'Wyliczenie', // name of the enum type |
228 | | - 'smw_bool' => 'Wartość logiczna', // name of the boolean type |
229 | | - 'smw_int' => 'Liczba całkowita', // name of the int type |
230 | | - 'smw_float' => 'Liczba zmiennoprzecinkowa', // name of the floating point type |
231 | | - 'smw_geocoordinate' => 'Współrzędne geograficzne', // name of the geocoord type |
232 | | - 'smw_temperature' => 'Temperatura', // name of the temperature type |
233 | | - 'smw_datetime' => 'Data', // name of the datetime (calendar) type |
234 | | - 'smw_email' => 'Email', // name of the email (URI) type |
235 | | - 'smw_url' => 'URL', // name of the URL type (string datatype property) |
236 | | - 'smw_uri' => 'URI', // name of the URI type (object property) |
237 | | - 'smw_annouri' => 'Annotation URI' // name of the annotation URI type (annotation property) //TODO: translate |
| 223 | +protected $m_DatatypeLabels = array( |
| 224 | + '_wpg' => 'Page', // name of page datatype //TODO translate |
| 225 | + '_str' => 'Łańcuch znaków', // name of the string type |
| 226 | + '_txt' => 'Text', // name of the text type (very long strings) //TODO: translate |
| 227 | + '_enu' => 'Wyliczenie', // name of the enum type |
| 228 | + '_boo' => 'Wartość logiczna', // name of the boolean type |
| 229 | + '_int' => 'Liczba całkowita', // name of the int type |
| 230 | + '_flt' => 'Liczba zmiennoprzecinkowa', // name of the floating point type |
| 231 | + '_geo' => 'Współrzędne geograficzne', // name of the geocoord type |
| 232 | + '_tem' => 'Temperatura', // name of the temperature type |
| 233 | + '_dat' => 'Data', // name of the datetime (calendar) type |
| 234 | + '_ema' => 'Email', // name of the email (URI) type |
| 235 | + '_url' => 'URL', // name of the URL type (string datatype property) |
| 236 | + '_uri' => 'URI', // name of the URI type (object property) |
| 237 | + '_anu' => 'Annotation URI' // name of the annotation URI type (annotation property) //TODO: translate |
238 | 238 | ); |
239 | 239 | |
| 240 | +protected $m_DatatypeAliases = array( |
| 241 | + // support English aliases: |
| 242 | + 'Page' => '_wpg', |
| 243 | + 'String' => '_str', |
| 244 | + 'Text' => '_txt', |
| 245 | + 'Integer' => '_int', |
| 246 | + 'Float' => '_flt', |
| 247 | + 'Geographic coordinate' => '_geo', |
| 248 | + 'Temperature' => '_tem', |
| 249 | + 'Date' => '_dat', |
| 250 | + 'Email' => '_ema', |
| 251 | + 'Annotation URI' => '_anu' |
| 252 | +); |
| 253 | + |
240 | 254 | protected $smwSpecialProperties = array( |
241 | 255 | //always start upper-case |
242 | 256 | SMW_SP_HAS_TYPE => 'Ma typ', |
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageHe.php |
— | — | @@ -197,23 +197,38 @@ |
198 | 198 | 'smw_result_noresults' => 'מצטערת, אין תוצאות' |
199 | 199 | ); |
200 | 200 | |
201 | | -protected $smwDatatypeLabels = array( |
202 | | - 'smw_wikipage' => 'Page', // name of page datatype //TODO translate |
203 | | - 'smw_string' => 'מחרוזת', // name of the string type |
204 | | - 'smw_text' => 'Text', // name of the text type (very long strings) //TODO: translate |
205 | | - 'smw_enum' => 'Enumeration', // name of the enum type |
206 | | - 'smw_bool' => 'נכוןלאנכון', // name of the boolean type |
207 | | - 'smw_int' => 'שלם', // name of the int type |
208 | | - 'smw_float' => 'נקודהצפה', // name of the floating point type |
209 | | - 'smw_geocoordinate' => 'קורדינטות גיאוגרפיות', // name of the geocoord type |
210 | | - 'smw_temperature' => 'טמפרטורה', // name of the temperature type |
211 | | - 'smw_datetime' => 'תאריך', // name of the datetime (calendar) type |
212 | | - 'smw_email' => 'דואל', // name of the email (URI) type |
213 | | - 'smw_url' => 'URL', // name of the URL type (string datatype property) |
214 | | - 'smw_uri' => 'מזהה יחודי', // name of the URI type (object property) |
215 | | - 'smw_annouri' => 'Annotation URI' // name of the annotation URI type (annotation property) |
| 201 | +protected $m_DatatypeLabels = array( |
| 202 | + '_wpg' => 'Page', // name of page datatype //TODO translate |
| 203 | + '_str' => 'מחרוזת', // name of the string type |
| 204 | + '_txt' => 'Text', // name of the text type (very long strings) //TODO: translate |
| 205 | + '_enu' => 'Enumeration', // name of the enum type |
| 206 | + //'_boo' => 'נכוןלאנכון', // name of the boolean type |
| 207 | + '_int' => 'שלם', // name of the int type |
| 208 | + '_flt' => 'נקודהצפה', // name of the floating point type |
| 209 | + '_geo' => 'קורדינטות גיאוגרפיות', // name of the geocoord type |
| 210 | + '_tem' => 'טמפרטורה', // name of the temperature type |
| 211 | + '_dat' => 'תאריך', // name of the datetime (calendar) type |
| 212 | + '_ema' => 'דואל', // name of the email (URI) type |
| 213 | + '_url' => 'URL', // name of the URL type (string datatype property) |
| 214 | + '_uri' => 'מזהה יחודי', // name of the URI type (object property) |
| 215 | + '_anu' => 'Annotation URI' // name of the annotation URI type (annotation property) |
216 | 216 | ); |
217 | 217 | |
| 218 | +protected $m_DatatypeAliases = array( |
| 219 | + // support English aliases: |
| 220 | + 'Page' => '_wpg', |
| 221 | + 'String' => '_str', |
| 222 | + 'Text' => '_txt', |
| 223 | + 'Integer' => '_int', |
| 224 | + 'Float' => '_flt', |
| 225 | + 'Geographic coordinate' => '_geo', |
| 226 | + 'Temperature' => '_tem', |
| 227 | + 'Date' => '_dat', |
| 228 | + 'Email' => '_ema', |
| 229 | + 'URI' => '_uri', |
| 230 | + 'Annotation URI' => '_anu' |
| 231 | +); |
| 232 | + |
218 | 233 | protected $smwSpecialProperties = array( |
219 | 234 | //always start upper-case |
220 | 235 | SMW_SP_HAS_TYPE => 'מטיפוס', |
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageSk.php |
— | — | @@ -196,23 +196,37 @@ |
197 | 197 | 'smw_result_noresult' => 'Prepáčte, žiadne výsledky.' |
198 | 198 | ); |
199 | 199 | |
200 | | -protected $smwDatatypeLabels = array( |
201 | | - 'smw_wikipage' => 'Page', // name of page datatype //TODO translate |
202 | | - 'smw_string' => 'Reťazec', // name of the string type |
203 | | - 'smw_text' => 'Text', // name of the text type (very long strings) //TODO: translate |
204 | | - 'smw_enum' => 'Enumeration', // name of the enum type TODO: translate |
205 | | - 'smw_bool' => 'Boolean', // name of the boolean type TODO: translate |
206 | | - 'smw_int' => 'Celé číslo', // name of the int type |
207 | | - 'smw_float' => 'Desatinné číslo', // name of the floating point type |
208 | | - 'smw_geocoordinate' => 'Zemepisné súradnice', // name of the geocoord type |
209 | | - 'smw_temperature' => 'Teplota', // name of the temperature type |
210 | | - 'smw_datetime' => 'Dátum', // name of the datetime (calendar) type |
211 | | - 'smw_email' => 'Email', // name of the email (URI) type |
212 | | - 'smw_url' => 'URL', // name of the URL type (string datatype property) |
213 | | - 'smw_uri' => 'URI', // name of the URI type (object property) |
214 | | - 'smw_annouri' => 'URI anotácie' // name of the annotation URI type (annotation property) |
| 200 | +protected $m_DatatypeLabels = array( |
| 201 | + '_wpg' => 'Page', // name of page datatype //TODO translate |
| 202 | + '_str' => 'Reťazec', // name of the string type |
| 203 | + '_txt' => 'Text', // name of the text type (very long strings) //TODO: translate |
| 204 | + '_enu' => 'Enumeration', // name of the enum type TODO: translate |
| 205 | + '_boo' => 'Boolean', // name of the boolean type TODO: translate |
| 206 | + '_int' => 'Celé číslo', // name of the int type |
| 207 | + '_flt' => 'Desatinné číslo', // name of the floating point type |
| 208 | + '_geo' => 'Zemepisné súradnice', // name of the geocoord type |
| 209 | + '_tem' => 'Teplota', // name of the temperature type |
| 210 | + '_dat' => 'Dátum', // name of the datetime (calendar) type |
| 211 | + '_ema' => 'Email', // name of the email (URI) type |
| 212 | + '_url' => 'URL', // name of the URL type (string datatype property) |
| 213 | + '_uri' => 'URI', // name of the URI type (object property) |
| 214 | + '_anu' => 'URI anotácie' // name of the annotation URI type (annotation property) |
215 | 215 | ); |
216 | 216 | |
| 217 | +protected $m_DatatypeAliases = array( |
| 218 | + // support English aliases: |
| 219 | + 'Page' => '_wpg', |
| 220 | + 'String' => '_str', |
| 221 | + 'Text' => '_txt', |
| 222 | + 'Integer' => '_int', |
| 223 | + 'Float' => '_flt', |
| 224 | + 'Geographic coordinate' => '_geo', |
| 225 | + 'Temperature' => '_tem', |
| 226 | + 'Date' => '_dat', |
| 227 | + 'Email' => '_ema', |
| 228 | + 'Annotation URI' => '_anu' |
| 229 | +); |
| 230 | + |
217 | 231 | protected $smwSpecialProperties = array( |
218 | 232 | //always start upper-case |
219 | 233 | SMW_SP_HAS_TYPE => 'Má typ', |
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_Language.php |
— | — | @@ -11,8 +11,9 @@ |
12 | 12 | // the message arrays ... |
13 | 13 | protected $smwContentMessages; |
14 | 14 | protected $smwUserMessages; |
15 | | - protected $smwDatatypeLabels; |
16 | 15 | protected $smwSpecialProperties; |
| 16 | + protected $m_DatatypeLabels; |
| 17 | + protected $m_DatatypeAliases = array(); |
17 | 18 | |
18 | 19 | /** |
19 | 20 | * Function that returns an array of namespace identifiers. |
— | — | @@ -20,7 +21,26 @@ |
21 | 22 | abstract function getNamespaceArray(); |
22 | 23 | |
23 | 24 | /** |
| 25 | + * Return all labels that are available as names for built-in datatypes. Those |
| 26 | + * are the types that users can access via [[has type::...]] (more built-in |
| 27 | + * types may exist for internal purposes but the user won't need to |
| 28 | + * know this). The returned array is indexed by (internal) type ids. |
| 29 | + */ |
| 30 | + function getDatatypeLabels() { |
| 31 | + return $this->m_DatatypeLabels; |
| 32 | + } |
| 33 | + |
| 34 | + /** |
| 35 | + * Return an array that maps aliases to internal type ids. All ids used here |
| 36 | + * should also have a primary label defined in m_DatatypeLabels. |
| 37 | + */ |
| 38 | + function getDatatypeAliases() { |
| 39 | + return $this->m_DatatypeAliases; |
| 40 | + } |
| 41 | + |
| 42 | + /** |
24 | 43 | * Function that returns the localised label for a datatype. |
| 44 | + * @DEPRECATED |
25 | 45 | */ |
26 | 46 | function getDatatypeLabel($msgid) { |
27 | 47 | return $this->smwDatatypeLabels[$msgid]; |
— | — | @@ -31,6 +51,7 @@ |
32 | 52 | * are exactly the types that users can access via [[has type::...]] (more |
33 | 53 | * built-in types may exist for internal purposes but the user won't need to |
34 | 54 | * know this). |
| 55 | + * @DEPRECATED |
35 | 56 | */ |
36 | 57 | function getAllDatatypeLabels() { |
37 | 58 | return $this->smwDatatypeLabels; |
— | — | @@ -40,6 +61,7 @@ |
41 | 62 | * Find the internal message id of some localised message string |
42 | 63 | * for a datatype. If no type of the given name exists (maybe a |
43 | 64 | * custom of compound type) then FALSE is returned. |
| 65 | + * @DEPRECATED |
44 | 66 | */ |
45 | 67 | function findDatatypeMsgID($label) { |
46 | 68 | return array_search($label, $this->smwDatatypeLabels); |
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageEn.php |
— | — | @@ -179,21 +179,21 @@ |
180 | 180 | 'smw_result_noresults' => 'Sorry, no results.' |
181 | 181 | ); |
182 | 182 | |
183 | | -protected $smwDatatypeLabels = array( |
184 | | - 'smw_wikipage' => 'Page', // name of page datatype |
185 | | - 'smw_string' => 'String', // name of the string type |
186 | | - 'smw_text' => 'Text', // name of the text type |
187 | | - 'smw_enum' => 'Enumeration', // name of the enum type |
188 | | - 'smw_bool' => 'Boolean', // name of the boolean type |
189 | | - 'smw_int' => 'Integer', // name of the int type |
190 | | - 'smw_float' => 'Float', // name of the floating point type |
191 | | - 'smw_geocoordinate' => 'Geographic coordinate', // name of the geocoord type |
192 | | - 'smw_temperature' => 'Temperature', // name of the temperature type |
193 | | - 'smw_datetime' => 'Date', // name of the datetime (calendar) type |
194 | | - 'smw_email' => 'Email', // name of the email (URI) type |
195 | | - 'smw_url' => 'URL', // name of the URL type (string datatype property) |
196 | | - 'smw_uri' => 'URI', // name of the URI type (object property) |
197 | | - 'smw_annouri' => 'Annotation URI' // name of the annotation URI type (annotation property) |
| 183 | +protected $m_DatatypeLabels = array( |
| 184 | + '_wpg' => 'Page', // name of page datatype |
| 185 | + '_str' => 'String', // name of the string type |
| 186 | + '_txt' => 'Text', // name of the text type |
| 187 | + '_enu' => 'Enumeration', // name of the enum type |
| 188 | + //'_boo' => 'Boolean', // name of the boolean type |
| 189 | + '_int' => 'Integer', // name of the int type |
| 190 | + '_flt' => 'Float', // name of the floating point type |
| 191 | + '_geo' => 'Geographic coordinate', // name of the geocoord type |
| 192 | + '_tem' => 'Temperature', // name of the temperature type |
| 193 | + '_dat' => 'Date', // name of the datetime (calendar) type |
| 194 | + '_ema' => 'Email', // name of the email (URI) type |
| 195 | + '_url' => 'URL', // name of the URL type (string datatype property) |
| 196 | + '_uri' => 'URI', // name of the URI type (object property) |
| 197 | + '_anu' => 'Annotation URI' // name of the annotation URI type (annotation property) |
198 | 198 | ); |
199 | 199 | |
200 | 200 | protected $smwSpecialProperties = array( |
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageRu.php |
— | — | @@ -195,23 +195,37 @@ |
196 | 196 | 'smw_result_noresults' => 'Извините, но ничего не найдено.' |
197 | 197 | ); |
198 | 198 | |
199 | | -protected $smwDatatypeLabels = array( |
200 | | - 'smw_wikipage' => 'Page', // name of page datatype //TODO translate |
201 | | - 'smw_string' => 'Строка', // name of the string type |
202 | | - 'smw_text' => 'Text', // name of the text type (very long strings) //TODO: translate |
203 | | - 'smw_enum' => 'Перечисление', // name of the enum type |
204 | | - 'smw_bool' => 'Булево', // name of the boolean type |
205 | | - 'smw_int' => 'Целое', // name of the int type |
206 | | - 'smw_float' => 'Десятичное', // name of the floating point type |
207 | | - 'smw_geocoordinate' => 'Географическая координата', // name of the geocoord type |
208 | | - 'smw_temperature' => 'Температура', // name of the temperature type |
209 | | - 'smw_datetime' => 'Дата', // name of the datetime (calendar) type |
210 | | - 'smw_email' => 'Почта', // name of the email (URI) type |
211 | | - 'smw_url' => 'URL', // name of the URL type (string datatype property) |
212 | | - 'smw_uri' => 'URI', // name of the URI type (object property) |
213 | | - 'smw_annouri' => 'URI аннотации' // name of the annotation URI type (annotation property) |
| 199 | +protected $m_DatatypeLabels = array( |
| 200 | + '_wpg' => 'Page', // name of page datatype //TODO translate |
| 201 | + '_str' => 'Строка', // name of the string type |
| 202 | + '_txt' => 'Text', // name of the text type (very long strings) //TODO: translate |
| 203 | + '_enu' => 'Перечисление', // name of the enum type |
| 204 | + '_boo' => 'Булево', // name of the boolean type |
| 205 | + '_int' => 'Целое', // name of the int type |
| 206 | + '_flt' => 'Десятичное', // name of the floating point type |
| 207 | + '_geo' => 'Географическая координата', // name of the geocoord type |
| 208 | + '_tem' => 'Температура', // name of the temperature type |
| 209 | + '_dat' => 'Дата', // name of the datetime (calendar) type |
| 210 | + '_ema' => 'Почта', // name of the email (URI) type |
| 211 | + '_url' => 'URL', // name of the URL type (string datatype property) |
| 212 | + '_uri' => 'URI', // name of the URI type (object property) |
| 213 | + '_anu' => 'URI аннотации' // name of the annotation URI type (annotation property) |
214 | 214 | ); |
215 | 215 | |
| 216 | +protected $m_DatatypeAliases = array( |
| 217 | + // support English aliases: |
| 218 | + 'Page' => '_wpg', |
| 219 | + 'String' => '_str', |
| 220 | + 'Text' => '_txt', |
| 221 | + 'Integer' => '_int', |
| 222 | + 'Float' => '_flt', |
| 223 | + 'Geographic coordinate' => '_geo', |
| 224 | + 'Temperature' => '_tem', |
| 225 | + 'Date' => '_dat', |
| 226 | + 'Email' => '_ema', |
| 227 | + 'Annotation URI' => '_anu' |
| 228 | +); |
| 229 | + |
216 | 230 | protected $smwSpecialProperties = array( |
217 | 231 | //always start upper-case |
218 | 232 | SMW_SP_HAS_TYPE => 'Имеет тип', |