? openlayers-localizations-750810-23.patch
? openlayers-localizations-750810-24.patch
? includes/layer_types/vector.inc
? includes/layer_types/vector.js
Index: openlayers.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/openlayers/openlayers.install,v
retrieving revision 1.12.2.9
diff -u -p -r1.12.2.9 openlayers.install
--- openlayers.install	13 Apr 2010 14:55:47 -0000	1.12.2.9
+++ openlayers.install	2 May 2010 13:50:35 -0000
@@ -108,11 +108,13 @@ function openlayers_schema() {
         'not null' => TRUE,
         'default' => '',
         'description' => 'Layer title.',
+        'translatable' => TRUE,
       ),
       'description' => array(
         'type' => 'text',
         'not null' => TRUE,
         'description' => 'Layer description.',
+        'translatable' => TRUE,
       ),
       'data' => array(
         'type' => 'text',
Index: openlayers.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/openlayers/openlayers.module,v
retrieving revision 1.69.2.66
diff -u -p -r1.69.2.66 openlayers.module
--- openlayers.module	2 May 2010 10:27:31 -0000	1.69.2.66
+++ openlayers.module	2 May 2010 13:50:35 -0000
@@ -227,8 +227,13 @@ function openlayers_get_layer_object($la
     $layer_types = openlayers_layer_types();
   }
 
-  $layer->title = t($layer->title);
-  $layer->description = t($layer->description);
+  // Manually translate the title and description for layers not in code.
+  // This needs to take into account a way of declaring a field
+  // as translatable
+  if (!isset($layer->in_code_only) || $layer->in_code_only !== TRUE) {
+    $layer->title = openlayers_tt('layers:title:' . $layer->name, $layer->title);
+    $layer->description = openlayers_tt('layers:description:' . $layer->name, $layer->description);
+  }
 
   // Attempt to get ctool class
   if (isset($layer_types[$layer->data['layer_type']]) && 
@@ -810,3 +815,40 @@ function openlayers_openlayers_layer_typ
   module_load_include('inc', 'openlayers', 'includes/openlayers.layer_types');
   return _openlayers_openlayers_layer_types();
 }
+
+/**   
+ * Translate user defined string. Wrapper function for tt() if i18nstrings enabled. 
+ *
+ * @param $name
+ *   Textgroup and location glued with ':'.
+ * @param $string
+ *   String in default language. Default language may or may not be English.
+ * @param $langcode
+ *   Optional language code if different from current request language.
+ * @param $update
+ *   Whether to force update/create for the string.
+ */   
+function openlayers_tt($name, $string, $langcode = NULL, $update = FALSE) {
+  // Translate function.  It seems like instead of tt, i18n is moving
+  // to il8nstrings() as the translation function.
+  $func = 'tt';
+
+  // Provide automatic prefix
+  $name = 'openlayers:' . $name;
+  
+  // Statically make sure tt() is available
+  static $tt;
+  if (!isset($tt)) {
+    if (module_exists('18nstrings') && function_exists($func)) {
+      $tt = $func;
+    }
+  }
+
+  // Translate!
+  if ($tt) {
+    return $tt($name, $string, $langcode, $update);
+  }
+  else {
+    return t($string);
+  }
+}
Index: includes/openlayers.layers.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/openlayers/includes/Attic/openlayers.layers.inc,v
retrieving revision 1.9.2.21
diff -u -p -r1.9.2.21 openlayers.layers.inc
--- includes/openlayers.layers.inc	26 Apr 2010 21:20:19 -0000	1.9.2.21
+++ includes/openlayers.layers.inc	2 May 2010 13:50:35 -0000
@@ -12,8 +12,8 @@ function _openlayers_openlayers_layers()
   $layer = new stdClass();
   $layer->api_version = 1;
   $layer->name = 'google_satellite';
-  $layer->title = 'Google Maps Satellite';
-  $layer->description = 'Google Maps Satellite Imagery.';
+  $layer->title = t('Google Maps Satellite');
+  $layer->description = t('Google Maps Satellite Imagery.');
   $layer->data = array(
     'baselayer' => TRUE,
     'type' => 'satellite',
@@ -25,8 +25,8 @@ function _openlayers_openlayers_layers()
   $layer = new stdClass();
   $layer->api_version = 1;
   $layer->name = 'google_hybrid';
-  $layer->title = 'Google Maps Hybrid';
-  $layer->description = 'Google Maps with roads and terrain.';
+  $layer->title = t('Google Maps Hybrid');
+  $layer->description = t('Google Maps with roads and terrain.');
   $layer->data = array(
     'baselayer' => TRUE,
     'type' => 'hybrid',
@@ -38,8 +38,8 @@ function _openlayers_openlayers_layers()
   $layer = new stdClass();
   $layer->api_version = 1;
   $layer->name = 'google_normal';
-  $layer->title = 'Google Maps Normal';
-  $layer->description = 'Standard Google Maps Roads';
+  $layer->title = t('Google Maps Normal');
+  $layer->description = t('Standard Google Maps Roads');
   $layer->data = array(
     'baselayer' => TRUE,
     'type' => 'normal',
@@ -51,8 +51,8 @@ function _openlayers_openlayers_layers()
   $layer = new stdClass();
   $layer->api_version = 1;
   $layer->name = 'google_physical';
-  $layer->title = 'Google Maps Physical';
-  $layer->description = 'Google Maps Hillshades';
+  $layer->title = t('Google Maps Physical');
+  $layer->description = t('Google Maps Hillshades');
   $layer->data = array(
     'baselayer' => TRUE,
     'type' => 'physical',
@@ -64,8 +64,8 @@ function _openlayers_openlayers_layers()
   $layer = new stdClass();
   $layer->api_version = 1;
   $layer->name = 'yahoo_satellite';
-  $layer->title = 'Yahoo Maps Satellite';
-  $layer->description = 'Yahoo satellite imagery tiles.';
+  $layer->title = t('Yahoo Maps Satellite');
+  $layer->description = t('Yahoo satellite imagery tiles.');
   $layer->data = array(
     'baselayer' => TRUE,
     'type' => 'satellite',
@@ -77,8 +77,8 @@ function _openlayers_openlayers_layers()
   $layer = new stdClass();
   $layer->api_version = 1;
   $layer->name = 'yahoo_street';
-  $layer->title = 'Yahoo Maps Street';
-  $layer->description = 'Yahoo streets tiles.';
+  $layer->title = t('Yahoo Maps Street');
+  $layer->description = t('Yahoo streets tiles.');
   $layer->data = array(
     'baselayer' => TRUE,
     'type' => 'street',
@@ -90,8 +90,8 @@ function _openlayers_openlayers_layers()
   $layer = new stdClass();
   $layer->api_version = 1;
   $layer->name = 'yahoo_hybrid';
-  $layer->title = 'Yahoo Maps Hybrid';
-  $layer->description = 'Yahoo hybrid of streets and satellite tiles.';
+  $layer->title = t('Yahoo Maps Hybrid');
+  $layer->description = t('Yahoo hybrid of streets and satellite tiles.');
   $layer->data = array(
     'baselayer' => TRUE,
     'type' => 'hybrid',
@@ -103,8 +103,8 @@ function _openlayers_openlayers_layers()
   $layer = new stdClass();
   $layer->api_version = 1;
   $layer->name = 'virtualearth_street';
-  $layer->title = 'Virtual Earth Street';
-  $layer->description = 'Virtual Earth (Bing) street tiles.';
+  $layer->title = t('Virtual Earth Street');
+  $layer->description = t('Virtual Earth (Bing) street tiles.');
   $layer->data = array(
     'baselayer' => TRUE,
     'type' => 'street',
@@ -116,8 +116,8 @@ function _openlayers_openlayers_layers()
   $layer = new stdClass();
   $layer->api_version = 1;
   $layer->name = 'virtualearth_satellite';
-  $layer->title = 'Virtual Earth Satellite';
-  $layer->description = 'Virtual Earth (Bing) satellite tiles.';
+  $layer->title = t('Virtual Earth Satellite');
+  $layer->description = t('Virtual Earth (Bing) satellite tiles.');
   $layer->data = array(
     'baselayer' => TRUE,
     'type' => 'satellite',
@@ -129,8 +129,8 @@ function _openlayers_openlayers_layers()
   $layer = new stdClass();
   $layer->api_version = 1;
   $layer->name = 'virtualearth_hybrid';
-  $layer->title = 'Virtual Earth Hybrid';
-  $layer->description = 'Virtual Earth (Bing) hybrid of streets and satellite tiles.';
+  $layer->title = t('Virtual Earth Hybrid');
+  $layer->description = t('Virtual Earth (Bing) hybrid of streets and satellite tiles.');
   $layer->data = array(
     'baselayer' => TRUE,
     'type' => 'hybrid',
@@ -143,8 +143,8 @@ function _openlayers_openlayers_layers()
   $layer = new stdClass();
   $layer->api_version = 1;
   $layer->name = 'osm_mapnik';
-  $layer->title = 'OSM Mapnik';
-  $layer->description = 'The main OpenStreetMap map';
+  $layer->title = t('OSM Mapnik');
+  $layer->description = t('The main OpenStreetMap map');
   $layer->data = array(
     'baselayer' => TRUE,
     'attribution' => t('&copy;<a href="@ccbysa">CCBYSA</a> 2010
@@ -164,8 +164,8 @@ function _openlayers_openlayers_layers()
   $layer = new stdClass();
   $layer->api_version = 1;
   $layer->name = 'osm_tah';
-  $layer->title = 'OSM Tiles@Home';
-  $layer->description = 'Alternative, community-rendered OpenStreetMap';
+  $layer->title = t('OSM Tiles@Home');
+  $layer->description = t('Alternative, community-rendered OpenStreetMap');
   $layer->data = array(
     'baselayer' => TRUE,
     'attribution' => t('&copy;<a href="@ccbysa">CCBYSA</a> 2010
@@ -185,8 +185,8 @@ function _openlayers_openlayers_layers()
   $layer = new stdClass();
   $layer->api_version = 1;
   $layer->name = 'osm_cycle';
-  $layer->title = 'OSM Cycling Map';
-  $layer->description = 'OpenStreetMap with highlighted bike lanes';
+  $layer->title = t('OSM Cycling Map');
+  $layer->description = t('OpenStreetMap with highlighted bike lanes');
   $layer->data = array(
     'baselayer' => TRUE,
     'attribution' => t('&copy;<a href="@ccbysa">CCBYSA</a> 2010
@@ -206,7 +206,7 @@ function _openlayers_openlayers_layers()
   $layer = new stdClass();
   $layer->api_version = 1;
   $layer->name = 'osm_4326_hybrid';
-  $layer->title = 'OSM Overlay';
+  $layer->title = t('OSM Overlay');
   $layer->description = 'Semi-transparent hybrid overlay. Projected into 
     WSG84 for use on non spherical-mercator maps.';
   $layer->data = array(
@@ -234,8 +234,8 @@ function _openlayers_openlayers_layers()
   $layer = new stdClass();
   $layer->api_version = 1;
   $layer->name = 'wms_default';
-  $layer->title = 'Default OpenLayers WMS';
-  $layer->description = 'MetaCarta basemap of province and water boundaries';
+  $layer->title = t('Default OpenLayers WMS');
+  $layer->description = t('MetaCarta basemap of province and water boundaries');
   $layer->data = array(
     'projection' => array('4326'),
     'baselayer' => TRUE,
@@ -250,46 +250,4 @@ function _openlayers_openlayers_layers()
 
 
   return $layers;
-}
-
-/**
- * This function is for the po editor to be able to find these strings, 
- * since in the codebase they are not in t()'s, because they are later 
- * run through t() in the layer loader function
- */
-function _openlayers_openlayers_layers_i18n() {
-  $translatable_strings = array(
-    // titles
-    t('Google Maps Satellite'),
-    t('Google Maps Hybrid'),
-    t('Google Maps Normal'),
-    t('Google Maps Physical'),
-    t('Yahoo Maps Street'),
-    t('Yahoo Maps Hybrid'),
-    t('Yahoo Maps Satellite'),
-    t('Virtual Earth Street'),
-    t('Virtual Earth Satellite'),
-    t('Virtual Earth Hybrid'),
-    t('OSM Mapnik'),
-    t('OSM Tiles@Home'),
-    t('OSM Cycling Map'),
-    t('OSM Overlay'),
-    t('Default OpenLayers WMS'),
-    // descriptions
-    t('Alternative, community-rendered OpenStreetMap'),
-    t('Google Maps Hillshades'),
-    t('Google Maps Satellite Imagery.'),
-    t('Google Maps with roads and terrain.'),
-    t('MetaCarta basemap of province and water boundaries'),
-    t('OpenStreetMap with highlighted bike lanes'),
-    t('Semi-transparent hybrid overlay. Projected into 
-      WSG84 for use on non spherical-mercator maps.'),
-    t('Standard Google Maps Roads'),
-    t('The main OpenStreetMap map'),
-    t('Virtual Earth (Bing) hybrid of streets and satellite tiles.'),
-    t('Virtual Earth (Bing) satellite tiles.'),
-    t('Virtual Earth (Bing) street tiles.'),
-    t('Yahoo hybrid of streets and satellite tiles.'),
-    t('Yahoo satellite imagery tiles.'),
-    t('Yahoo streets tiles.'));
-}
+}
\ No newline at end of file
Index: modules/openlayers_ui/openlayers_ui.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/openlayers/modules/openlayers_ui/Attic/openlayers_ui.module,v
retrieving revision 1.1.2.29
diff -u -p -r1.1.2.29 openlayers_ui.module
--- modules/openlayers_ui/openlayers_ui.module	24 Mar 2010 20:43:32 -0000	1.1.2.29
+++ modules/openlayers_ui/openlayers_ui.module	2 May 2010 13:50:35 -0000
@@ -487,7 +487,7 @@ function openlayers_ui_object_export(&$f
   // Use CTools to create export code
   ctools_include('export');
   $code = '$items = array();' ."\n";
-  $code .= ctools_export_object($api, $object, '');
+  $code .= openlayers_export_object($api, $object, '');
   $code .= '$items["'. $object->name .'"] = $' . $api . ';' ."\n";
   $code .= 'return $items;';
   $rows = substr_count($code, "\n") + 1;
@@ -623,3 +623,69 @@ function openlayers_ui_get_style_options
   }
   return $options;
 }
+
+/**
+ * Custom export object
+ *
+ * This is a copy from ctools_export_object() with ability to
+ * add translation into it.
+ */
+function openlayers_export_object($table, $object, $indent = '', $identifier = NULL, $additions = array(), $additions2 = array()) {
+  $schema = ctools_export_get_schema($table);
+  if (!isset($identifier)) {
+    $identifier = $schema['export']['identifier'];
+  }
+
+  $output = $indent . '$' . $identifier . ' = new ' . get_class($object) . ";\n";
+
+  if ($schema['export']['can disable']) {
+    $output .= $indent . '$' . $identifier . '->disabled = FALSE; /* Edit this to true to make a default ' . $identifier . ' disabled initially */' . "\n";
+  }
+  if (!empty($schema['export']['api']['current_version'])) {
+    $output .= $indent . '$' . $identifier . '->api_version = ' . $schema['export']['api']['current_version'] . ";\n";
+  }
+
+  // Put top additions here:
+  foreach ($additions as $field => $value) {
+    $output .= $indent . '$' . $identifier . '->' . $field . ' = ' . ctools_var_export($value, $indent) . ";\n";
+  }
+
+  // Go through our schema and build correlations.
+  foreach ($schema['fields'] as $field => $info) {
+    if (!empty($info['no export'])) {
+      continue;
+    }
+    if (!isset($object->$field)) {
+      if (isset($info['default'])) {
+        $object->$field = $info['default'];
+      }
+      else {
+        $object->$field = '';
+      }
+    }
+
+    if (!empty($info['export callback']) && function_exists($info['export callback'])) {
+      $output .= $indent . '$' . $identifier . '->' . $field . ' = ' . $info['export callback']($object, $field, $value, $indent) . ";\n";
+    }
+    else {
+      $value = $object->$field;
+      if ($info['type'] == 'int') {
+        $value = (isset($info['size']) && $info['size'] == 'tiny') ? (bool) $value : (int) $value;
+      }
+
+      if (is_array($info) && $info['translatable']) {
+        $output .= $indent . '$' . $identifier . '->' . $field . ' = t(' . ctools_var_export($value, $indent) . ");\n";
+      }
+      else {
+        $output .= $indent . '$' . $identifier . '->' . $field . ' = ' . ctools_var_export($value, $indent) . ";\n";
+      }
+    }
+  }
+
+  // And bottom additions here
+  foreach ($additions2 as $field => $value) {
+    $output .= $indent . '$' . $identifier . '->' . $field . ' = ' . ctools_var_export($value, $indent) . ";\n";
+  }
+
+  return $output;
+}
Index: modules/openlayers_ui/includes/openlayers_ui.layers.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/openlayers/modules/openlayers_ui/includes/Attic/openlayers_ui.layers.inc,v
retrieving revision 1.1.2.6
diff -u -p -r1.1.2.6 openlayers_ui.layers.inc
--- modules/openlayers_ui/includes/openlayers_ui.layers.inc	22 Mar 2010 23:55:10 -0000	1.1.2.6
+++ modules/openlayers_ui/includes/openlayers_ui.layers.inc	2 May 2010 13:50:35 -0000
@@ -198,6 +198,9 @@ function openlayers_ui_layers_import_for
  * Validate handler to import a preset
  */
 function openlayers_ui_layers_import_validate($form, &$form_state) {
+  // Remove any t()
+  // This could probably be better regex
+  $layer = preg_replace("/t\(\'(.*)\'\)/", '\'$1\'', $form_state['values']['layer']);
 
   $items = '';
   ob_start();
