summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.txt2
-rw-r--r--gmap.strings.inc58
-rw-r--r--gmap.strings.php67
-rw-r--r--gmap_markerinfo.inc2
4 files changed, 128 insertions, 1 deletions
diff --git a/README.txt b/README.txt
index e9ded30..17454eb 100644
--- a/README.txt
+++ b/README.txt
@@ -34,6 +34,8 @@ If you are using the HTML filter, it will need to appear BEFORE the GMap filter;
* If you would like to use third party functionality such as mouse wheel support
or Clusterer, read thirdparty/README.txt for download links and instructions.
+* If you are translating this module to a different language also see the gmap.strings.php file for further installation instructions. This is required for translation of marker type strings to work.
+
Google Maps and XHTML
---------------------
diff --git a/gmap.strings.inc b/gmap.strings.inc
new file mode 100644
index 0000000..1930737
--- /dev/null
+++ b/gmap.strings.inc
@@ -0,0 +1,58 @@
+<?php
+// $Id$
+
+function gmap_marker_labels_potx() {
+ $marker_labels = array(
+ 0 => t('Small Red'),
+ 1 => t('Small Bright red'),
+ 2 => t('Small Orange'),
+ 3 => t('Small Pale Yellow'),
+ 4 => t('Small Yellow'),
+ 5 => t('Small Pale Green'),
+ 6 => t('Small Green'),
+ 7 => t('Small Dark Green'),
+ 8 => t('Small Flouro Green'),
+ 9 => t('Small Pale Blue'),
+ 10 => t('Small Light Blue'),
+ 11 => t('Small Blue'),
+ 12 => t('Small Dark Blue'),
+ 13 => t('Small Purple'),
+ 14 => t('Small Pink'),
+ 15 => t('Small Bright Pink'),
+ 16 => t('Small Brown'),
+ 17 => t('Small White'),
+ 18 => t('Small Light Gray'),
+ 19 => t('Small Gray'),
+ 20 => t('Small Black'),
+ 21 => t('Small Blue (Alternate)'),
+ 22 => t('Small Red (Alternate)'),
+ 23 => t('Big Blue'),
+ 24 => t('Big Red'),
+ 25 => t('X marks the spot'),
+ 26 => t('Sunday'),
+ 27 => t('Monday'),
+ 28 => t('Tuesday'),
+ 29 => t('Wednesday'),
+ 30 => t('Thursday'),
+ 31 => t('Friday'),
+ 32 => t('Saturday'),
+ 33 => t('Week'),
+ 34 => t('Blank'),
+ 35 => t('Cluster'),
+ 36 => t('Drupal'),
+ 37 => t('Line Vertex'),
+ 38 => t('Letters'),
+ 39 => t('Blue'),
+ 40 => t('Gray'),
+ 41 => t('Green'),
+ 42 => t('Light Blue'),
+ 43 => t('Orange'),
+ 44 => t('Pink'),
+ 45 => t('Purple'),
+ 46 => t('White'),
+ 47 => t('Yellow'),
+ 48 => t('Numbers'),
+ 49 => t('Route'),
+ );
+ return $marker_labels;
+}
diff --git a/gmap.strings.php b/gmap.strings.php
new file mode 100644
index 0000000..0bd3072
--- /dev/null
+++ b/gmap.strings.php
@@ -0,0 +1,67 @@
+<?php
+// $Id$
+/**
+ * gmap.strings.php
+ *
+ * PURPOSE
+ *
+ * This is a stand-alone script which takes markers titles and wraps them in t()'s.
+ * The reason we want to do this is because variables can not be passed through t()
+ * with .pot files generated by the potx module.
+ *
+ * The result of running this script should be the creation of a file in the root of the gmap module's
+ * directory, called 'gmap.strings.inc', containing a function 'gmap_marker_labels' which returns an
+ * array holding each of the marker labels wrapped in t().
+ *
+ * INSTALLATION
+ *
+ * This script needs to be run within drupal, so the best way to accomplish this is to install and enable
+ * the devel module, then, enable the 'Execute PHP' block somewhere.
+ *
+ * Then, just paste this script into the text field in the Execute PHP block, and click 'Execute'!
+ * This will create the gmap.strings.inc file in the gmap module's directory - be sure to adjust the permissions
+ * of this new file appropriately!
+ */
+
+$markerdir = variable_get('gmap_markerfiles', drupal_get_path('module', 'gmap') . '/markers');
+
+// The following routines are designed to be easy to comprehend, not fast.
+// This whole process gets cached.
+
+// Get the ini files.
+$inifiles = file_scan_directory($markerdir, '.*\.ini$');
+
+$labels = array();
+foreach ($inifiles as $file) {
+ $icon_data = parse_ini_file($file->filename, TRUE);
+ foreach ($icon_data as $icon_set) {
+ if (isset($icon_set['name'])) {
+ $marker_labels[] = "t('" . $icon_set['name'] . "'),";
+ }
+ }
+}
+
+// Create a .inc file for our info.
+$gmap_strings_inc_name = drupal_get_path('module', 'gmap') . '/gmap.strings.inc';
+
+// Open our file.
+$gmap_strings_inc_handle = fopen($gmap_strings_inc_name, 'w');
+
+// Format the data.
+$label_container .= "<?php\n\nfunction gmap_marker_labels_potx() {\n";
+$label_container .= "\$marker_labels = array(\n";
+
+
+foreach ($marker_labels as $label_key => $label) {
+ $label_container .= "$label_key" . ' => ' . "$label" . "\n";
+}
+$label_container .= ')';
+$label_container .= ";\n";
+$label_container .= "return \$marker_labels\n";
+$label_container .= '}';
+
+// Write file.
+if (fwrite($gmap_strings_inc_handle, $label_container) !== 'FALSE') {
+ drupal_set_message(t('File gmap_strings.inc successfully created.'));
+}
+?>
diff --git a/gmap_markerinfo.inc b/gmap_markerinfo.inc
index 3599377..21fbd6c 100644
--- a/gmap_markerinfo.inc
+++ b/gmap_markerinfo.inc
@@ -244,7 +244,7 @@ function _gmap_get_marker_titles() {
$titles = array();
foreach ($inis as $ini => $inidata) {
foreach ($inidata as $k => $v) {
- $titles[$k] = $inis[$ini][$k]['name'];
+ $titles[$k] = t($inis[$ini][$k]['name']);
}
}
return $titles;