Index: trunk/extensions/SemanticMaps/SM_GeoCoordsValue.php |
— | — | @@ -37,7 +37,6 @@ |
38 | 38 | // Note: signs are used as e.g. on Google maps, i.e. S and W are negative numbers.
|
39 | 39 |
|
40 | 40 | protected function parseUserValue($value) {
|
41 | | - wfLoadExtensionMessages('SemanticMediaWiki');
|
42 | 41 | $this->m_lat = false;
|
43 | 42 | $this->m_long = false;
|
44 | 43 | $this->m_latparts = false;
|
— | — | @@ -66,7 +65,7 @@ |
67 | 66 | $angles[0] = $curnum;
|
68 | 67 | $curnum = false;
|
69 | 68 | } else {
|
70 | | - $this->addError(wfMsgForContent('smw_lonely_unit', $part));
|
| 69 | + $this->addError(wfMsgForContent('semanticmaps_lonely_unit', $part));
|
71 | 70 | }
|
72 | 71 | break;
|
73 | 72 | case SM_GEO_MIN:
|
— | — | @@ -75,7 +74,7 @@ |
76 | 75 | if ($angles[0] === false) $angles[0] = 0;
|
77 | 76 | $curnum = false;
|
78 | 77 | } else {
|
79 | | - $this->addError(wfMsgForContent('smw_lonely_unit', $part));
|
| 78 | + $this->addError(wfMsgForContent('semanticmaps_lonely_unit', $part));
|
80 | 79 | }
|
81 | 80 | break;
|
82 | 81 | case SM_GEO_SEC:
|
— | — | @@ -85,13 +84,13 @@ |
86 | 85 | if ($angles[1] === false) $angles[1] = 0;
|
87 | 86 | $curnum = false;
|
88 | 87 | } else {
|
89 | | - $this->addError(wfMsgForContent('smw_lonely_unit', $part));
|
| 88 | + $this->addError(wfMsgForContent('semanticmaps_lonely_unit', $part));
|
90 | 89 | }
|
91 | 90 | break;
|
92 | 91 | case 'N': case 'S': // interpret findings as latitude
|
93 | 92 | if ( $curnum !== false ) { // work off number without °
|
94 | 93 | if ($angles[0] !== false) { // "12° 34" as coordinate, complain
|
95 | | - $this->addError(wfMsgForContent('smw_bad_latlong'));
|
| 94 | + $this->addError(wfMsgForContent('semanticmaps_bad_latlong'));
|
96 | 95 | break;
|
97 | 96 | } else {
|
98 | 97 | $angles[0] = $curnum;
|
— | — | @@ -101,13 +100,13 @@ |
102 | 101 | if (($this->m_lat === false) && ($angles[0] !== false)) {
|
103 | 102 | $this->setAngleValues($part,$angles);
|
104 | 103 | } else {
|
105 | | - $this->addError(wfMsgForContent('smw_bad_latlong'));
|
| 104 | + $this->addError(wfMsgForContent('semanticmaps_bad_latlong'));
|
106 | 105 | }
|
107 | 106 | break;
|
108 | 107 | case 'E': case 'W': // interpret findings as longitude
|
109 | 108 | if ( $curnum !== false ) { // work off number without °
|
110 | 109 | if ($angles[0] !== false) { // "12° 34" as coordinate, complain
|
111 | | - $this->addError(wfMsgForContent('smw_bad_latlong'));
|
| 110 | + $this->addError(wfMsgForContent('semanticmaps_bad_latlong'));
|
112 | 111 | break;
|
113 | 112 | } else {
|
114 | 113 | $angles[0] = $curnum;
|
— | — | @@ -117,13 +116,13 @@ |
118 | 117 | if (($this->m_long === false) && ($angles[0] !== false)) {
|
119 | 118 | $this->setAngleValues($part,$angles);
|
120 | 119 | } else {
|
121 | | - $this->addError(wfMsgForContent('smw_bad_latlong'));
|
| 120 | + $this->addError(wfMsgForContent('semanticmaps_bad_latlong'));
|
122 | 121 | }
|
123 | 122 | break;
|
124 | 123 | case ';': // interpret findings as latitude
|
125 | 124 | if ( $curnum !== false ) { // work off number without °
|
126 | 125 | if ($angles[0] !== false) { // "12° 34" as coordinate, complain
|
127 | | - $this->addError(wfMsgForContent('smw_bad_latlong'));
|
| 126 | + $this->addError(wfMsgForContent('semanticmaps_bad_latlong'));
|
128 | 127 | break;
|
129 | 128 | } else {
|
130 | 129 | $angles[0] = $curnum;
|
— | — | @@ -137,7 +136,7 @@ |
138 | 137 | case '': break; // ignore
|
139 | 138 | default: // should be a number (if not, errors appear elsewhere)
|
140 | 139 | // no kiloseps in coordinates, use as decsep as a convenience to some users (Bug 11808):
|
141 | | - $curnum = str_replace(wfMsgForContent('smw_kiloseparator'), wfMsgForContent('smw_decseparator'), $part);
|
| 140 | + $curnum = str_replace(wfMsgForContent('semanticmaps_kiloseparator'), wfMsgForContent('semanticmaps_decseparator'), $part);
|
142 | 141 | break;
|
143 | 142 | }
|
144 | 143 | }
|
— | — | @@ -168,11 +167,10 @@ |
169 | 168 |
|
170 | 169 | public function getShortWikiText($linked = NULL) {
|
171 | 170 | if ($this->isValid() && ($linked !== NULL) && ($linked !== false)) {
|
172 | | - wfLoadExtensionMessages('SemanticMediaWiki');
|
173 | 171 | SMWOutputs::requireHeadItem(SMW_HEADER_TOOLTIP);
|
174 | 172 | return '<span class="smwttinline">' . $this->m_caption . '<span class="smwttcontent">' .
|
175 | | - wfMsgForContent('smw_label_latitude') . ' ' . $this->formatAngleValues(true) . '<br />' .
|
176 | | - wfMsgForContent('smw_label_longitude') . ' ' . $this->formatAngleValues(false) .
|
| 173 | + wfMsgForContent('semanticmaps_label_latitude') . ' ' . $this->formatAngleValues(true) . '<br />' .
|
| 174 | + wfMsgForContent('semanticmaps_label_longitude') . ' ' . $this->formatAngleValues(false) .
|
177 | 175 | '</span></span>';
|
178 | 176 | } else {
|
179 | 177 | return $this->m_caption;
|
— | — | @@ -218,11 +216,10 @@ |
219 | 217 | * Get and cache localised direction labels. Just for convenience.
|
220 | 218 | */
|
221 | 219 | protected function initDirectionLabels() {
|
222 | | - wfLoadExtensionMessages('SemanticMediaWiki');
|
223 | | - $this->m_N = wfMsgForContent('smw_abb_north');
|
224 | | - $this->m_E = wfMsgForContent('smw_abb_east');
|
225 | | - $this->m_W = wfMsgForContent('smw_abb_west');
|
226 | | - $this->m_S = wfMsgForContent('smw_abb_south');
|
| 220 | + $this->m_N = wfMsgForContent('semanticmaps_abb_north');
|
| 221 | + $this->m_E = wfMsgForContent('semanticmaps_abb_east');
|
| 222 | + $this->m_W = wfMsgForContent('semanticmaps_abb_west');
|
| 223 | + $this->m_S = wfMsgForContent('semanticmaps_abb_south');
|
227 | 224 | }
|
228 | 225 |
|
229 | 226 | /**
|
— | — | @@ -231,7 +228,6 @@ |
232 | 229 | * each possibly false if unset.
|
233 | 230 | */
|
234 | 231 | protected function setAngleValues($direction, &$angles) {
|
235 | | - wfLoadExtensionMessages('SemanticMediaWiki');
|
236 | 232 | $numvalue = SMWDataValueFactory::newTypeIDValue('_num');
|
237 | 233 | $res = 0;
|
238 | 234 | $factor = 1;
|
— | — | @@ -241,7 +237,7 @@ |
242 | 238 | if ($numvalue->isValid() && ($numvalue->getUnit() == '')) {
|
243 | 239 | $res += $numvalue->getNumericValue() / $factor;
|
244 | 240 | } else {
|
245 | | - $this->addError(wfMsgForContent('smw_nofloat', $angles[$i]));
|
| 241 | + $this->addError(wfMsgForContent('semanticmaps_nofloat', $angles[$i]));
|
246 | 242 | }
|
247 | 243 | }
|
248 | 244 | $factor = $factor * 60;
|
Index: trunk/extensions/SemanticMaps/SemanticMaps.i18n.php |
— | — | @@ -16,24 +16,39 @@ |
17 | 17 | */ |
18 | 18 | |
19 | 19 | $messages['en'] = array( |
| 20 | + // General |
20 | 21 | 'semanticmaps_name' => 'Semantic Maps', |
21 | 22 | 'semanticmaps_desc' => "Provides the ability to view and edit coordinate data stored through the Semantic MediaWiki extension ([http://wiki.bn2vs.com/wiki/Semantic_Maps demo]). |
22 | 23 | Available map services: $1", |
23 | | - 'semanticmaps_lookupcoordinates' => 'Look up coordinates', |
24 | | - 'semanticmaps_enteraddresshere' => 'Enter address here', |
25 | | - 'semanticmaps_notfound' => 'not found', |
26 | | - 'semanticmaps_paramdesc_format' => 'The mapping service used to generate the map', |
| 24 | + |
| 25 | + // Geo coord data type |
| 26 | + 'semanticmaps_lonely_unit' => 'No number found before the symbol "$1".', // $1 is something like ° |
| 27 | + 'semanticmaps_bad_latlong' => 'Latitude and longitude must be given only once, and with valid coordinates.', |
| 28 | + 'semanticmaps_abb_north' => 'N', |
| 29 | + 'semanticmaps_abb_east' => 'E', |
| 30 | + 'semanticmaps_abb_south' => 'S', |
| 31 | + 'semanticmaps_abb_west' => 'W', |
| 32 | + 'semanticmaps_label_latitude' => 'Latitude:', |
| 33 | + 'semanticmaps_label_longitude' => 'Longitude:', |
| 34 | + |
| 35 | + // Forms |
| 36 | + 'semanticmaps_lookupcoordinates' => 'Look up coordinates', |
| 37 | + 'semanticmaps_enteraddresshere' => 'Enter address here', |
| 38 | + 'semanticmaps_notfound' => 'not found', |
| 39 | + |
| 40 | + // Parameter descriptions |
| 41 | + 'semanticmaps_paramdesc_format' => 'The mapping service used to generate the map', |
27 | 42 | 'semanticmaps_paramdesc_geoservice' => 'The geocoding service used to turn addresses into coordinates', |
28 | | - 'semanticmaps_paramdesc_height' => 'The height of the map, in pixels (default is $1)', |
29 | | - 'semanticmaps_paramdesc_width' => 'The width of the map, in pixels (default is $1)', |
30 | | - 'semanticmaps_paramdesc_zoom' => 'The zoom level of the map', |
31 | | - 'semanticmaps_paramdesc_centre' => 'The coordinates of the maps\' centre', |
32 | | - 'semanticmaps_paramdesc_controls' => 'The user controls placed on the map', |
33 | | - 'semanticmaps_paramdesc_types' => 'The map types available on the map', |
34 | | - 'semanticmaps_paramdesc_type' => 'The default map type for the map', |
35 | | - 'semanticmaps_paramdesc_overlays' => 'The overlays available on the map', |
36 | | - 'semanticmaps_paramdesc_autozoom' => 'Whether or not one can zoom in and out by using the mouse scroll wheel', |
37 | | - 'semanticmaps_paramdesc_layers' => 'The layers available on the map', |
| 43 | + 'semanticmaps_paramdesc_height' => 'The height of the map, in pixels (default is $1)', |
| 44 | + 'semanticmaps_paramdesc_width' => 'The width of the map, in pixels (default is $1)', |
| 45 | + 'semanticmaps_paramdesc_zoom' => 'The zoom level of the map', |
| 46 | + 'semanticmaps_paramdesc_centre' => 'The coordinates of the maps\' centre', |
| 47 | + 'semanticmaps_paramdesc_controls' => 'The user controls placed on the map', |
| 48 | + 'semanticmaps_paramdesc_types' => 'The map types available on the map', |
| 49 | + 'semanticmaps_paramdesc_type' => 'The default map type for the map', |
| 50 | + 'semanticmaps_paramdesc_overlays' => 'The overlays available on the map', |
| 51 | + 'semanticmaps_paramdesc_autozoom' => 'Whether or not one can zoom in and out by using the mouse scroll wheel', |
| 52 | + 'semanticmaps_paramdesc_layers' => 'The layers available on the map', |
38 | 53 | ); |
39 | 54 | |
40 | 55 | /** Message documentation (Message documentation) |
Index: trunk/extensions/SemanticMaps/SemanticMaps.php |
— | — | @@ -23,7 +23,7 @@ |
24 | 24 | die( 'Not an entry point.' ); |
25 | 25 | } |
26 | 26 | |
27 | | -define('SM_VERSION', '0.5 a13'); |
| 27 | +define('SM_VERSION', '0.5 a14'); |
28 | 28 | |
29 | 29 | $smgScriptPath = $wgScriptPath . '/extensions/SemanticMaps'; |
30 | 30 | $smgIP = $IP . '/extensions/SemanticMaps'; |
— | — | @@ -37,11 +37,12 @@ |
38 | 38 | |
39 | 39 | $wgHooks['AdminLinks'][] = 'smfAddToAdminLinks'; |
40 | 40 | |
41 | | -//$wgAutoloadClasses['SMGeoCoordsValue'] = $smgIP . '/SM_GeoCoordsValue.php'; |
42 | | -//$wgHooks['smwInitDatatypes'][] = 'smfInitGeoCoordsType'; |
43 | | - |
44 | 41 | $wgExtensionMessagesFiles['SemanticMaps'] = $smgIP . '/SemanticMaps.i18n.php'; |
45 | 42 | |
| 43 | +// Registration of the Geographical Coordinate type. |
| 44 | +$wgAutoloadClasses['SMGeoCoordsValue'] = $smgIP . '/SM_GeoCoordsValue.php'; |
| 45 | +$wgHooks['smwInitDatatypes'][] = 'smfInitGeoCoordsType'; |
| 46 | + |
46 | 47 | /** |
47 | 48 | * 'Initialization' function for the Semantic Maps extension. |
48 | 49 | * The only work done here is creating the extension credits for |