? 750810-export-translation-30.patch
? includes/layer_types/vector.inc
? modules/openlayers_views/views/openlayers-views-data.tpl.php
? tests/js/openlayers_test.context.js
Index: openlayers.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/openlayers/openlayers.module,v
retrieving revision 1.69.2.72
diff -u -p -r1.69.2.72 openlayers.module
--- openlayers.module	2 Jun 2010 15:17:44 -0000	1.69.2.72
+++ openlayers.module	3 Jun 2010 06:59:07 -0000
@@ -51,6 +51,50 @@ function openlayers_theme($existing, $ty
 }
 
 /**
+ * Translate or update user defined string.
+ *
+ * Wrapper function for 18nstrings translation function
+ * so that translations can be supported even without this
+ * module, but in a limted way.
+ * 
+ * @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 $textgroup
+ *   A prefix for the $name of the string to translate.
+ * 
+ * @return $string
+ *   Translated string, $string if not found
+ */
+function openlayers_translate($name, $string, $langcode = NULL, $textgroup = 'openlayers') {
+  // Translate function.  It seems like instead of tt, i18n is moving
+  // to il8nstrings() as the translation function.
+  $func = 'i18nstrings';
+
+  // Provide automatic prefix
+  $name = $textgroup . ':' . $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);
+  }  
+}
+
+/**
  * Include necessary CSS and JS for OpenLayers.
  *
  * @ingroup openlayers_api
@@ -181,9 +225,12 @@ function openlayers_get_layer_object($la
   if (!isset($layer_types)) {
     $layer_types = openlayers_layer_types();
   }
-
-  $layer->title = t($layer->title);
-  $layer->description = t($layer->description);
+  
+  // Translate title and description
+  $layer->title = openlayers_translate(
+    'layer:' . $layer->name . ':title', $layer->title);
+  $layer->description = openlayers_translate(
+    'layer:' . $layer->name . ':description', $layer->description);
 
   // Attempt to get ctool class
   // class is renamed klass because of PHP keywords
@@ -414,8 +461,18 @@ function openlayers_behaviors($reset = F
  */
 function openlayers_styles($reset = FALSE) {
   ctools_include('export');
-  if ($reset) ctools_export_load_object_reset('openlayers_styles');
+  if ($reset) {
+    ctools_export_load_object_reset('openlayers_styles');
+  }
   $styles = ctools_export_load_object('openlayers_styles', 'all', array());
+  
+  // Translate title and description
+  foreach ($styles as $name => $style) {
+    $styles[$name]->title = openlayers_translate(
+      'style:' . $name . ':title', $styles[$name]->title);
+    $styles[$name]->description = openlayers_translate(
+      'style:' . $name . ':description', $styles[$name]->description);
+  }
   return $styles;
 }
 
@@ -441,7 +498,6 @@ function openlayers_style_save($style) {
 }
 
 /**
- *
  * Get Presets from DB or code, via cache
  *
  * @ingroup openlayers_api
@@ -452,9 +508,19 @@ function openlayers_style_save($style) {
  */
 function openlayers_presets($reset = FALSE) {
   ctools_include('export');
-  if ($reset) ctools_export_load_object_reset('openlayers_map_presets');
+  if ($reset) {
+    ctools_export_load_object_reset('openlayers_map_presets');
+  }
   $presets = ctools_export_load_object(
     'openlayers_map_presets', 'all', array());
+  
+  // Translate title and description
+  foreach ($presets as $name => $preset) {
+    $presets[$name]->title = openlayers_translate(
+      'preset:' . $name . ':title', $presets[$name]->title);
+    $presets[$name]->description = openlayers_translate(
+      'preset:' . $name . ':description', $presets[$name]->description);
+  }
   return $presets;
 }
 
@@ -470,10 +536,7 @@ function openlayers_presets($reset = FAL
  *   Preset object
  */
 function openlayers_preset_load($name = '', $reset = FALSE) {
-  ctools_include('export');
-  if ($reset) ctools_export_load_object_reset('openlayers_map_presets');
-  $presets = ctools_export_load_object(
-    'openlayers_map_presets', 'names', array($name));
+  $presets = openlayers_presets($reset);
   return !empty($presets[$name]) ? $presets[$name] : FALSE;
 }
 
Index: docs/openlayers.api.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/openlayers/docs/Attic/openlayers.api.php,v
retrieving revision 1.2.2.5
diff -u -p -r1.2.2.5 openlayers.api.php
--- docs/openlayers.api.php	2 Jun 2010 23:13:40 -0000	1.2.2.5
+++ docs/openlayers.api.php	3 Jun 2010 06:59:07 -0000
@@ -203,6 +203,10 @@ function hook_openlayers_behaviors() {
  * Ensure that you are telling CTools about this as well.
  * @see openlayers_example_ctools_plugin_api().
  *
+ * Please note, that to support translation for exportable
+ * code for potx extraction, you should include separate code
+ * of translatable string.
+ *
  * @return
  *   Return an associative array with index being a unique string 
  *   identifier, and simple objects with the following properties:
@@ -215,12 +219,11 @@ function hook_openlayers_styles() {
   // Taken from openlayers.styles.inc
 
   $styles = array();
-
   $style = new stdClass();
   $style->api_version = 1;
   $style->name = 'default';
-  $style->title = t('Default style');
-  $style->description = t('Basic default style.');
+  $style->title = 'Default style');
+  $style->description = 'Basic default style.';
   $style->data = array(
     'pointRadius' => '5',
     'fillColor' => '#FFCC66',
@@ -229,14 +232,27 @@ function hook_openlayers_styles() {
     'fillOpacity' => '0.5'
   );
   $styles[$style->name] = $style;
-
   return $styles;
+  
+  // Extra code to support potx extractors
+  $potx = array(
+    t('Default style'),
+    t('Basic default style.'),
+  );
 }
 
 /**
  * OpenLayers Presets
  *
- * Define map presets.
+ * This hook tells OpenLayers about map presets that 
+ * store data to display maps.
+ *
+ * Ensure that you are telling CTools about this as well.
+ * @see openlayers_example_ctools_plugin_api().
+ *
+ * Please note, that to support translation for exportable
+ * code for potx extraction, you should include separate code
+ * of translatable string.
  *
  * @return
  *   Return an associative array with index being a unique string 
@@ -252,8 +268,8 @@ function hook_openlayers_presets() {
   $default = new stdClass();
   $default->api_version = 1;
   $default->name = 'default';
-  $default->title = t('Default Map');
-  $default->description = t('This is the default map preset that comes with the OpenLayers module.');
+  $default->title = 'Default Map';
+  $default->description = 'This is the default map preset that comes with the OpenLayers module.';
   $default->data = array(
     'projection' => '900913',
     'width' => 'auto',
@@ -281,4 +297,10 @@ function hook_openlayers_presets() {
     )
   );
   return array('default' => $default);
+  
+  // Extra code to support potx extractors
+  $potx = array(
+    t('Default Map'),
+    t('This is the default map preset that comes with the OpenLayers module.'),
+  );
 }
Index: includes/openlayers.presets.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/openlayers/includes/Attic/openlayers.presets.inc,v
retrieving revision 1.1.2.4
diff -u -p -r1.1.2.4 openlayers.presets.inc
--- includes/openlayers.presets.inc	6 May 2010 14:37:40 -0000	1.1.2.4
+++ includes/openlayers.presets.inc	3 Jun 2010 06:59:08 -0000
@@ -21,8 +21,8 @@ function _openlayers_openlayers_presets(
   $default = new stdClass();
   $default->api_version = 1;
   $default->name = 'default';
-  $default->title = t('Default Map');
-  $default->description = t('This is the default map preset that comes with the OpenLayers module.');
+  $default->title = 'Default Map';
+  $default->description = 'This is the default map preset that comes with the OpenLayers module.';
   $default->data = array(
     'projection' => '900913',
     'width' => 'auto',
@@ -52,3 +52,15 @@ function _openlayers_openlayers_presets(
   );
   return array('default' => $default);
 }
+
+/**
+ * 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_presets_i18n() {
+  $potx = array(
+    t('Default Map'),
+    t('This is the default map preset that comes with the OpenLayers module.'),
+  );
+}
Index: includes/openlayers.styles.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/openlayers/includes/Attic/openlayers.styles.inc,v
retrieving revision 1.3.2.5
diff -u -p -r1.3.2.5 openlayers.styles.inc
--- includes/openlayers.styles.inc	7 Mar 2010 20:17:21 -0000	1.3.2.5
+++ includes/openlayers.styles.inc	3 Jun 2010 06:59:08 -0000
@@ -22,8 +22,8 @@ function _openlayers_openlayers_styles()
   $style = new stdClass();
   $style->api_version = 1;
   $style->name = 'default';
-  $style->title = t('Default style');
-  $style->description = t('Basic default style.');
+  $style->title = 'Default style';
+  $style->description = 'Basic default style.';
   $style->data = array(
     'pointRadius' => '5',
     'fillColor' => '#FFCC66',
@@ -36,8 +36,8 @@ function _openlayers_openlayers_styles()
   $style = new stdClass();
   $style->api_version = 1;
   $style->name = 'invisible';
-  $style->title = t('Invisible style');
-  $style->description = t('Invisible default style.');
+  $style->title = 'Invisible style';
+  $style->description = 'Invisible default style.';
   $style->data = array(
     'pointRadius' => '0',
     'strokeWidth' => '0',
@@ -48,8 +48,8 @@ function _openlayers_openlayers_styles()
   $style = new stdClass();
   $style->api_version = 1;
   $style->name = 'default_select';
-  $style->title = t('Default select style');
-  $style->description = t('Default style for selected geometries');
+  $style->title = 'Default select style';
+  $style->description = 'Default style for selected geometries';
   $style->data = array(
     'pointRadius' => '5',
     'fillColor' => '#66CCFF',
@@ -61,3 +61,19 @@ function _openlayers_openlayers_styles()
 
   return $styles;
 }
+
+/**
+ * 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_style_i18n() {
+  $potx = array(
+    t('Default style'),
+    t('Basic default style.'),
+    t('Invisible style'),
+    t('Invisible default style.'),
+    t('Default select style'),
+    t('Default style for selected geometries'),
+  );
+}
Index: tests/openlayers_test.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/openlayers/tests/Attic/openlayers_test.module,v
retrieving revision 1.2.2.13
diff -u -p -r1.2.2.13 openlayers_test.module
--- tests/openlayers_test.module	2 May 2010 10:27:31 -0000	1.2.2.13
+++ tests/openlayers_test.module	3 Jun 2010 06:59:08 -0000
@@ -62,8 +62,8 @@ function openlayers_test_openlayers_pres
   $behaviors_test = new stdClass();
   $behaviors_test->api_version = 1;
   $behaviors_test->name = 'behaviors_test';
-  $behaviors_test->title = t('Test: Behaviors');
-  $behaviors_test->description = t('This is a test preset.');
+  $behaviors_test->title = 'Test: Behaviors';
+  $behaviors_test->description = 'This is a test preset.';
   $behaviors_test->data = array(
     'projection' => '4326',
     'projection' => '900913',
@@ -213,6 +213,15 @@ function openlayers_test_openlayers_pres
 
   // Return presets
   return $items;
+  
+  // Extra code to support potx extractors
+  $potx = array(
+    t('Test: Behaviors'),
+    t('This is a test preset.'),
+    t('Test: OpenLayers Test Views'),
+    t('This preset tests a custom content type with a WKT field and ' .
+      'a views layer.'),
+  );
 }
 
 /**
