aboutsummaryrefslogtreecommitdiffstats
path: root/util/extract.php
diff options
context:
space:
mode:
authorMike Macgirvin <mike@macgirvin.com>2010-09-29 18:11:23 -0700
committerMike Macgirvin <mike@macgirvin.com>2010-09-29 18:11:23 -0700
commite25e40f1ef4e1ad703c55b13069461ee0d712eae (patch)
tree41966307ee765db01b6ecebcff447329605a6fe5 /util/extract.php
parent8ba3737b3b7284c9b7cf40028240ebf89daad1d7 (diff)
downloadvolse-hubzilla-e25e40f1ef4e1ad703c55b13069461ee0d712eae.tar.gz
volse-hubzilla-e25e40f1ef4e1ad703c55b13069461ee0d712eae.tar.bz2
volse-hubzilla-e25e40f1ef4e1ad703c55b13069461ee0d712eae.zip
i18n string extraction util
Diffstat (limited to 'util/extract.php')
-rw-r--r--util/extract.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/util/extract.php b/util/extract.php
new file mode 100644
index 000000000..bb16a47da
--- /dev/null
+++ b/util/extract.php
@@ -0,0 +1,38 @@
+<?php
+
+ $arr = array();
+
+ $files = array('index.php','boot.php');
+ $files = array_merge($files,glob('mod/*'),glob('include/*'));
+
+
+ foreach($files as $file) {
+ $str = file_get_contents($file);
+
+ $pat = '| t\(([^\)]*)\)|';
+
+ preg_match_all($pat,$str,$matches);
+
+ if(! count($matches))
+ continue;
+
+ foreach($matches[1] as $match) {
+ if(! in_array($match,$arr))
+ $arr[] = $match;
+ }
+
+ }
+
+ $s = '<?php' . "\n";
+ foreach($arr as $a) {
+ if(substr($a,0,1) == '$')
+ continue;
+
+ $s .= '$a->strings[' . $a . '] = ' . $a . ';' . "\n";
+ }
+
+ $zones = timezone_identifiers_list();
+ foreach($zones as $zone)
+ $s .= '$a->strings[\'' . $zone . '\'] = \'' . $zone . '\';' . "\n";
+
+ echo $s; \ No newline at end of file