aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/extract.php2
-rw-r--r--util/string_translator.php180
-rw-r--r--util/strings.php31
3 files changed, 208 insertions, 5 deletions
diff --git a/util/extract.php b/util/extract.php
index bb16a47da..92ec8501c 100644
--- a/util/extract.php
+++ b/util/extract.php
@@ -3,7 +3,7 @@
$arr = array();
$files = array('index.php','boot.php');
- $files = array_merge($files,glob('mod/*'),glob('include/*'));
+ $files = array_merge($files,glob('mod/*'),glob('include/*'),glob('addon/*/*'));
foreach($files as $file) {
diff --git a/util/string_translator.php b/util/string_translator.php
new file mode 100644
index 000000000..4d24f7a6f
--- /dev/null
+++ b/util/string_translator.php
@@ -0,0 +1,180 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+<style>
+ textarea { width: 100% }
+ .no { background: #ffdddd; }
+</style>
+</head>
+<body>
+<?php
+
+$FRIENDIKA_PATH = dirname(dirname(__FILE__));
+
+/* find languages */
+$LANGS=array();
+$d = dir($FRIENDIKA_PATH."/view");
+while (false !== ($entry = $d->read())) {
+ if (is_file($d->path."/".$entry."/strings.php")){
+ $LANGS[] = $entry;
+ }
+
+}
+$d->close();
+
+
+class A{
+ var $strings = Array();
+}
+
+function loadstrings($lang = NULL){
+ global $FRIENDIKA_PATH;
+ if (is_null($lang)) {
+ $path = $FRIENDIKA_PATH."/util/strings.php";
+ } else {
+ $path = $FRIENDIKA_PATH."/view/$lang/strings.php";
+ }
+ $a = new A();
+ include_once($path);
+ return $a->strings;
+}
+
+
+function savestrings($lang, $strings){
+ global $FRIENDIKA_PATH;
+ $path = $FRIENDIKA_PATH."/view/$lang/strings.php";
+ $f = fopen($path,"w");
+ fwrite($f, "<"); fwrite($f, "?php\n");
+ foreach($strings as $k=>$v){
+ $k=str_replace("'","\'", $k);
+ $k=str_replace("\\\\'","\'", $k);
+ $k=str_replace("\n","\\n", $k);
+ $k=str_replace("\r","\\r", $k);
+ $v=str_replace("'","\'", $v);
+ $v=str_replace("\\\\'","\'", $v);
+ $v=str_replace("\n","\\n", $v);
+ $v=str_replace("\r","\\r", $v);
+
+ fwrite( $f, '$a->strings[\''.$k.'\'] = \''. $v .'\';'."\n" );
+ #echo '$a->strings[\''.$k.'\'] = \''. $v .'\''."\n" ;
+ }
+ fwrite($f, "?"); fwrite($f, ">\n");
+ fclose($f);
+}
+
+
+
+function hexstr($hexstr) {
+ $hexstr = str_replace(' ', '', $hexstr);
+ $hexstr = str_replace('\x', '', $hexstr);
+ $retstr = pack('H*', $hexstr);
+ return $retstr;
+}
+
+function strhex($string) {
+ $hexstr = unpack('H*', $string);
+ return array_shift($hexstr);
+}
+
+
+echo "<h1>Translator</h1>";
+echo "<p>Utility to translate <code>string.php</code> file.";
+echo " Need write permission to language file you want to modify</p>";
+echo "<p>Installed languages:";
+echo "<ul>";
+foreach($LANGS as $l){
+ echo "<li><a href='?lang=$l'>$l</a></li>";
+}
+echo "</ul></p>";
+
+
+$strings['en'] = loadstrings();
+
+if (isset($_GET['lang'])){
+
+ $lang = $_GET['lang'];
+ $strings[$lang] = loadstrings($lang);
+
+ $n1 = count($strings['en']);
+ $n2 = count($strings[$lang]);
+
+ echo "<pre>";
+ echo "Tranlsate en to $lang<br>";
+ //echo "Translated $n2 over $n1 strings<br>";
+ echo "</pre><hr/>";
+
+
+
+ if (isset($_POST['save'])){
+ echo "saving...";
+ foreach ($_POST as $k=>$v){
+ if ($k!="save" && $k!="from"){
+ $k=hexstr($k);
+ $strings[$lang][$k] = $v;
+ }
+ }
+ savestrings($lang, $strings[$lang]);
+ echo "ok.<br>";
+ }
+
+
+
+
+
+ if (!isset($_POST['from'])){
+ $from=0;
+ } else {
+ $from = $_POST['from'];
+ if ($_POST['save']=="Next")
+ $from += 10;
+ if ($_POST['save']=="Prev")
+ $from -= 10;
+ }
+ $count = count($strings['en']);
+ $len = 10;
+ if ($from+$len>$count) $len=$count-$from;
+ $thestrings = array_slice($strings['en'], $from, $len, true);
+
+
+
+ echo "<form method='POST'>";
+
+ if ($from>0)
+ echo "<input type='submit' name='save' id='save' value='Prev'/>";
+ echo "<input type='submit' name='reload' id='reload' value='Reload'/>";
+ if ($from+$len<$count)
+ echo "<input type='submit' name='save' id='save' value='Next'/>";
+
+ foreach($thestrings as $k=>$v){
+ $id = strhex($k);
+ $translation = $strings[$lang][$k];
+
+ $v=str_replace("\n","\\n", $v);
+ $v=str_replace("\r","\\r", $v);
+ $translation=str_replace("\n","\\n", $translation);
+ $translation=str_replace("\r","\\r", $translation);
+
+ $istranslate = $translation != '' ? 'yes':'no';
+ echo "<dl class='$istranslate'>";
+ echo "<dt><label for='$id'>".htmlspecialchars($v)."</label></dt>";
+ echo "<dd><textarea id='$id' name='$id'>$translation</textarea></dd>";
+ echo "</dl>";
+ }
+
+
+ echo "<input type='hidden' name='from' value='$from'/>";
+
+ if ($from>0)
+ echo "<input type='submit' name='save' id='save' value='Prev'/>";
+ echo "<input type='submit' name='reload' id='reload' value='Reload'/>";
+ if ($from+$len<$count)
+ echo "<input type='submit' name='save' id='save' value='Next'/>";
+
+ echo "</form>";
+
+
+}
+?>
+</body>
+</html>
+
diff --git a/util/strings.php b/util/strings.php
index 8b58a6b7a..762c68d2b 100644
--- a/util/strings.php
+++ b/util/strings.php
@@ -84,6 +84,7 @@ $a->strings['Delete contact'] = 'Delete contact';
$a->strings['Last updated: '] = 'Last updated: ';
$a->strings['Update public posts: '] = 'Update public posts: ';
$a->strings['Never'] = 'Never';
+$a->strings['Update now'] = 'Update now';
$a->strings['Unblock this contact'] = 'Unblock this contact';
$a->strings['Block this contact'] = 'Block this contact';
$a->strings['Unignore this contact'] = 'Unignore this contact';
@@ -163,6 +164,7 @@ $a->strings['Private Message'] = 'Private Message';
$a->strings['This is you'] = 'This is you';
$a->strings['View $name\'s profile'] = 'View $name\'s profile';
$a->strings['Item has been removed.'] = 'Item has been removed.';
+$a->strings['Shared content is covered by the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license.'] = 'Shared content is covered by the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license.';
$a->strings['The profile address specified does not provide adequate information.'] = 'The profile address specified does not provide adequate information.';
$a->strings['Limited profile. This person will be unable to receive direct/personal notifications from you.'] = 'Limited profile. This person will be unable to receive direct/personal notifications from you.';
$a->strings['Unable to retrieve contact information.'] = 'Unable to retrieve contact information.';
@@ -211,7 +213,6 @@ $a->strings['Send invitations'] = 'Send invitations';
$a->strings['Enter email addresses, one per line:'] = 'Enter email addresses, one per line:';
$a->strings['Your message:'] = 'Your message:';
$a->strings['Please join my social network on '] = 'Please join my social network on ';
-$a->strings["\r\n"] = "\r\n";
$a->strings['To accept this invitation, please visit:'] = 'To accept this invitation, please visit:';
$a->strings['Once you have registered, please connect with me via my profile page at:'] = 'Once you have registered, please connect with me via my profile page at:';
$a->strings['Unable to locate original post.'] = 'Unable to locate original post.';
@@ -219,6 +220,11 @@ $a->strings['Empty post discarded.'] = 'Empty post discarded.';
$a->strings['Wall Photos'] = 'Wall Photos';
$a->strings[" commented on your item at "] = " commented on your item at ";
$a->strings[" posted on your profile wall at "] = " posted on your profile wall at ";
+$a->strings['This message was sent to you by '] = 'This message was sent to you by ';
+$a->strings[', a member of the Friendika social network.'] = ', a member of the Friendika social network.';
+$a->strings['You may visit them online at'] = 'You may visit them online at';
+$a->strings['Please contact the sender by replying to this post if you do not wish to receive these messages.'] = 'Please contact the sender by replying to this post if you do not wish to receive these messages.';
+$a->strings['posted an update.'] = 'posted an update.';
$a->strings['photo'] = 'photo';
$a->strings['status'] = 'status';
$a->strings['likes'] = 'likes';
@@ -251,6 +257,8 @@ $a->strings['Delete message'] = 'Delete message';
$a->strings['Send Reply'] = 'Send Reply';
$a->strings['Normal View'] = 'Normal View';
$a->strings['New Item View'] = 'New Item View';
+$a->strings['CC: email addresses'] = 'CC: email addresses';
+$a->strings['Example: bob@example.com, mary@example.com'] = 'Example: bob@example.com, mary@example.com';
$a->strings['No such group'] = 'No such group';
$a->strings['Group is empty'] = 'Group is empty';
$a->strings['Group: '] = 'Group: ';
@@ -287,9 +295,7 @@ $a->strings['No photos selected'] = 'No photos selected';
$a->strings['Upload Photos'] = 'Upload Photos';
$a->strings['New album name: '] = 'New album name: ';
$a->strings['or existing album name: '] = 'or existing album name: ';
-$a->strings['Select files to upload: '] = 'Select files to upload: ';
$a->strings['Permissions'] = 'Permissions';
-$a->strings['Use the following controls only if the Java uploader [above] fails to launch.'] = 'Use the following controls only if the Java uploader [above] fails to launch.';
$a->strings['Edit Album'] = 'Edit Album';
$a->strings['View Photo'] = 'View Photo';
$a->strings['Photo not available'] = 'Photo not available';
@@ -297,6 +303,7 @@ $a->strings['Edit photo'] = 'Edit photo';
$a->strings['View Full Size'] = 'View Full Size';
$a->strings['Tags: '] = 'Tags: ';
$a->strings['[Remove any tag]'] = '[Remove any tag]';
+$a->strings['New album name'] = 'New album name';
$a->strings['Caption'] = 'Caption';
$a->strings['Add a Tag'] = 'Add a Tag';
$a->strings['Example: @bob, @Barbara_Jensen, @jim@example.com, #California, #camping'] = 'Example: @bob, @Barbara_Jensen, @jim@example.com, #California, #camping';
@@ -340,7 +347,6 @@ $a->strings['Your registration is pending approval by the site owner.'] = 'Your
$a->strings["You may \x28optionally\x29 fill in this form via OpenID by supplying your OpenID and clicking 'Register'."] = "You may \x28optionally\x29 fill in this form via OpenID by supplying your OpenID and clicking 'Register'.";
$a->strings['If you are not familiar with OpenID, please leave that field blank and fill in the rest of the items.'] = 'If you are not familiar with OpenID, please leave that field blank and fill in the rest of the items.';
$a->strings["Your OpenID \x28optional\x29: "] = "Your OpenID \x28optional\x29: ";
-$a->strings['Shared content is covered by the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license.'] = 'Shared content is covered by the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license.';
$a->strings['Registration'] = 'Registration';
$a->strings['Your Full Name ' . "\x28" . 'e.g. Joe Smith' . "\x29" . ': '] = 'Your Full Name ' . "\x28" . 'e.g. Joe Smith' . "\x29" . ': ';
$a->strings['Your Email Address: '] = 'Your Email Address: ';
@@ -350,6 +356,9 @@ $a->strings['Register'] = 'Register';
$a->strings['Please login.'] = 'Please login.';
$a->strings['Registration revoked for '] = 'Registration revoked for ';
$a->strings['Account approved.'] = 'Account approved.';
+$a->strings['Remove My Account'] = 'Remove My Account';
+$a->strings['This will completely remove your account. Once this has been done it is not recoverable.'] = 'This will completely remove your account. Once this has been done it is not recoverable.';
+$a->strings['Please enter your password for verification:'] = 'Please enter your password for verification:';
$a->strings['Passwords do not match. Password unchanged.'] = 'Passwords do not match. Password unchanged.';
$a->strings['Empty passwords are not allowed. Password unchanged.'] = 'Empty passwords are not allowed. Password unchanged.';
$a->strings['Password changed.'] = 'Password changed.';
@@ -414,6 +423,7 @@ $a->strings['Network'] = 'Network';
$a->strings['Notifications'] = 'Notifications';
$a->strings['Settings'] = 'Settings';
$a->strings['Profiles'] = 'Profiles';
+$a->strings['Embedding disabled'] = 'Embedding disabled';
$a->strings['Male'] = 'Male';
$a->strings['Female'] = 'Female';
$a->strings['Currently Male'] = 'Currently Male';
@@ -467,6 +477,19 @@ $a->strings['Uncertain'] = 'Uncertain';
$a->strings['Complicated'] = 'Complicated';
$a->strings['Don\'t care'] = 'Don\'t care';
$a->strings['Ask me'] = 'Ask me';
+$a->strings['Facebook status update failed.'] = 'Facebook status update failed.';
+$a->strings['Select files to upload: '] = 'Select files to upload: ';
+$a->strings['Use the following controls only if the Java uploader [above] fails to launch.'] = 'Use the following controls only if the Java uploader [above] fails to launch.';
+$a->strings['Upload a file'] = 'Upload a file';
+$a->strings['Drop files here to upload'] = 'Drop files here to upload';
+$a->strings['Failed'] = 'Failed';
+$a->strings['No files were uploaded.'] = 'No files were uploaded.';
+$a->strings['Uploaded file is empty'] = 'Uploaded file is empty';
+$a->strings['Uploaded file is too large'] = 'Uploaded file is too large';
+$a->strings['File has an invalid extension, it should be one of '] = 'File has an invalid extension, it should be one of ';
+$a->strings['Upload was cancelled, or server error encountered'] = 'Upload was cancelled, or server error encountered';
+$a->strings['Randplace Settings'] = 'Randplace Settings';
+$a->strings['Enable Randplace Plugin'] = 'Enable Randplace Plugin';
$a->strings['Africa/Abidjan'] = 'Africa/Abidjan';
$a->strings['Africa/Accra'] = 'Africa/Accra';
$a->strings['Africa/Addis_Ababa'] = 'Africa/Addis_Ababa';