Skip to content

Commit

Permalink
Totally resorted the language files, added subscription strings
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanbrunker committed May 17, 2020
1 parent 11a78d5 commit c773b5f
Show file tree
Hide file tree
Showing 129 changed files with 66,932 additions and 57,248 deletions.
2 changes: 1 addition & 1 deletion include/admin/importers/generic.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function __construct($data) {
'type' => 'input',
'name' => 'url'),

array('text' => STATUS,
array('text' => IMPORT_STATUS,
'type' => 'list',
'name' => 'type',
'value' => 'publish',
Expand Down
2 changes: 1 addition & 1 deletion include/admin/importers/livejournal.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function __construct($data) {
'value' => 0,
'default' => $this->_getCategoryList()),

array('text' => STATUS,
array('text' => IMPORT_STATUS,
'type' => 'list',
'name' => 'type',
'value' => 'publish',
Expand Down
2 changes: 1 addition & 1 deletion include/functions_routing.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ function serveAuthorPage($matches) {
header('HTTP/1.0 404 Not found');
header('Status: 404 Not found');
} else {
$serendipity['head_title'] = sprintf(ENTRIES_BY, $uInfo[0]['realname']);
$serendipity['head_title'] = sprintf(ENTRIES_FOR, $uInfo[0]['realname']);
$serendipity['head_subtitle'] = $serendipity['blogTitle'];
}

Expand Down
4 changes: 2 additions & 2 deletions include/tpl/config_local.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,8 @@
'permission' => 'blogConfiguration'),

array('var' => 'enablePluginACL',
'title' => PERMISSION_FORBIDDEN_ENABLE,
'description' => PERMISSION_FORBIDDEN_ENABLE_DESC,
'title' => USERGROUPS_FORBIDDEN_ENABLE,
'description' => USERGROUPS_FORBIDDEN_ENABLE_DESC,
'type' => 'bool',
'default' => false,
'permission' => 'blogConfiguration'),
Expand Down
2,089 changes: 1,124 additions & 965 deletions lang/UTF-8/serendipity_lang_bg.inc.php

Large diffs are not rendered by default.

1,974 changes: 1,060 additions & 914 deletions lang/UTF-8/serendipity_lang_cn.inc.php

Large diffs are not rendered by default.

2,288 changes: 1,217 additions & 1,071 deletions lang/UTF-8/serendipity_lang_cs.inc.php

Large diffs are not rendered by default.

2,289 changes: 1,217 additions & 1,072 deletions lang/UTF-8/serendipity_lang_cz.inc.php

Large diffs are not rendered by default.

2,011 changes: 1,080 additions & 931 deletions lang/UTF-8/serendipity_lang_da.inc.php

Large diffs are not rendered by default.

1,974 changes: 1,059 additions & 915 deletions lang/UTF-8/serendipity_lang_de.inc.php

Large diffs are not rendered by default.

1,939 changes: 1,040 additions & 899 deletions lang/UTF-8/serendipity_lang_en.inc.php

Large diffs are not rendered by default.

1,973 changes: 1,056 additions & 917 deletions lang/UTF-8/serendipity_lang_es.inc.php

Large diffs are not rendered by default.

1,947 changes: 1,046 additions & 901 deletions lang/UTF-8/serendipity_lang_fa.inc.php

Large diffs are not rendered by default.

1,980 changes: 1,063 additions & 917 deletions lang/UTF-8/serendipity_lang_fi.inc.php

Large diffs are not rendered by default.

1,966 changes: 1,054 additions & 912 deletions lang/UTF-8/serendipity_lang_fr.inc.php

Large diffs are not rendered by default.

1,936 changes: 1,042 additions & 894 deletions lang/UTF-8/serendipity_lang_hu.inc.php

Large diffs are not rendered by default.

1,936 changes: 1,041 additions & 895 deletions lang/UTF-8/serendipity_lang_is.inc.php

Large diffs are not rendered by default.

1,970 changes: 1,057 additions & 913 deletions lang/UTF-8/serendipity_lang_it.inc.php

Large diffs are not rendered by default.

1,948 changes: 1,045 additions & 903 deletions lang/UTF-8/serendipity_lang_ja.inc.php

Large diffs are not rendered by default.

1,937 changes: 1,040 additions & 897 deletions lang/UTF-8/serendipity_lang_ko.inc.php

Large diffs are not rendered by default.

1,934 changes: 1,040 additions & 894 deletions lang/UTF-8/serendipity_lang_nl.inc.php

Large diffs are not rendered by default.

2,016 changes: 1,080 additions & 936 deletions lang/UTF-8/serendipity_lang_no.inc.php

Large diffs are not rendered by default.

1,953 changes: 1,051 additions & 902 deletions lang/UTF-8/serendipity_lang_pl.inc.php

Large diffs are not rendered by default.

1,985 changes: 1,064 additions & 921 deletions lang/UTF-8/serendipity_lang_pt.inc.php

Large diffs are not rendered by default.

1,998 changes: 1,068 additions & 930 deletions lang/UTF-8/serendipity_lang_pt_PT.inc.php

Large diffs are not rendered by default.

1,949 changes: 1,047 additions & 902 deletions lang/UTF-8/serendipity_lang_ro.inc.php

Large diffs are not rendered by default.

1,949 changes: 1,047 additions & 902 deletions lang/UTF-8/serendipity_lang_ru.inc.php

Large diffs are not rendered by default.

1,871 changes: 1,049 additions & 822 deletions lang/UTF-8/serendipity_lang_sa.inc.php

Large diffs are not rendered by default.

1,956 changes: 1,051 additions & 905 deletions lang/UTF-8/serendipity_lang_se.inc.php

Large diffs are not rendered by default.

2,268 changes: 1,218 additions & 1,050 deletions lang/UTF-8/serendipity_lang_sk.inc.php

Large diffs are not rendered by default.

1,950 changes: 1,048 additions & 902 deletions lang/UTF-8/serendipity_lang_ta.inc.php

Large diffs are not rendered by default.

1,944 changes: 1,044 additions & 900 deletions lang/UTF-8/serendipity_lang_tn.inc.php

Large diffs are not rendered by default.

1,951 changes: 1,047 additions & 904 deletions lang/UTF-8/serendipity_lang_tr.inc.php

Large diffs are not rendered by default.

1,945 changes: 1,044 additions & 901 deletions lang/UTF-8/serendipity_lang_tw.inc.php

Large diffs are not rendered by default.

1,974 changes: 1,061 additions & 913 deletions lang/UTF-8/serendipity_lang_zh.inc.php

Large diffs are not rendered by default.

206 changes: 206 additions & 0 deletions lang/langsorter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
<?php

// this function is meant to be run from the command line
// usage: php -f langsorter.php [arg1] [arg1]
// arg1: language file to sort, for example de
// arg2: folder, empty = language root folder, UTF-8 = subfolder
// or single argument -all to batch process all existing language files
// rearranges the language file the same as is in the english file
// missing definitions are copied from the english file
// removed definitions going to be removed
// if some values are going to be changed, do it to the array in line 86
// for example where the string has changed and to be back-set to english
// or change definition name by changing the array key
// remove this safety block
exit;

function getDef($line) {
$matches = array();
$def = preg_match("#@define\\('([a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*)',#", $line, $matches);
if (empty($matches[1])) {
return false;
}
return $matches[1];
}

function getVal($line) {
$matches = array();
$val = preg_match("#,(.+)\\);#", $line, $matches);
if (empty($matches[1])) return false;
return ' ' . trim($matches[1]);
}

function checkIgnore($line) {
if ( empty($line) ||
substr($line, 0, 1) == '/' ||
substr($line, 0, 1) == '#' ||
substr($line, 0, 5) == '<?php' ||
substr($line, 0, 2) == '?>' ) {
return true;
} else { return false; }
}

function synclang($dir, $lancode) {
global $refarray, $refstart;

// load target language
$tarlang = file_get_contents( $dir . 'serendipity_lang_' . $lancode . '.inc.php');

if ($tarlang === false) {
echo "Error: cannot load target file\n";
exit;
}

// explode file into lines
$tararray = explode("\n", $tarlang);

// get first definition line
foreach ($tararray as $key => $value) {
if ( strpos($value, "@define('LANG_CHARSET',") !== false ) {
$tarstart = $key;
break;
}
}

$tardefs = array();
// split target definitions in key - value array
echo "prepare target language file ...\r\n";
for ($i = $tarstart; $i < count($tararray); $i++) {
$line = $tararray[$i];
if (checkIgnore($line)) continue;
if (preg_match("#@define( +)\\(( +)'[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*'( +),#", $value) !== 0 ) {
echo "line " . ($key + 1) . " contains additional spaces\r\n";
exit;
}
$def = getDef($line, $i);
if ($def === false) {
echo "no definition found in line " . ($i + 1) . ": " . $line . "\r\n";
exit;
}
$val = getVal($line, $i);
if ($val === false) {
echo "no value found in line " . ($i + 1) . ": " . $line . "\r\n";
exit;
}
$tardefs[$def] = $val;
}

// make changes, e.g. delete translations which have to be changed
unset($tardefs['IFRAME_SAVE']);

echo "OK\r\n";
$output = array_slice($tararray, 0, $tarstart);

echo "sort target language according to template file ...\r\n";
for ($i = $refstart; $i < count($refarray); $i++) {
$line = $refarray[$i];
if (checkIgnore($line)) {
$output[] = $line;
continue;
}
$def = getDef($line, $i);
if (array_key_exists($def, $tardefs)) {
$output[] = "@define('{$def}',{$tardefs[$def]});";
} else {
echo "definition {$def} missing from target file, copying from template\r\n";
$output[] = $line;
}
}
echo "OK\r\n\r\n";

if (!file_exists($dir . 'processed')) mkdir($dir . 'processed', 0777, true);

file_put_contents( $dir . 'processed/serendipity_lang_' . $lancode . '.inc.php', implode("\n", $output));

}

// ===========================
// program start
// ===========================

if (!is_array($argv) || empty($argv[1])) {
echo "This tool is intended to be called via commandline!\n";
exit;
}

// argument = language code of the file to be converted
$lancode = $argv[1];

// load template language
$reflang = file_get_contents('serendipity_lang_en.inc.php');

// explode file into lines
$refarray = explode("\n", $reflang);

// get first definition line
foreach ($refarray as $key => $value) {
if ( strpos($value, "@define('LANG_CHARSET',") !== false ) {
$refstart = $key;
break;
}
}

// check syntax of reference files
echo "syntax check of reference file ...\r\n";
foreach ($refarray as $key => $value) {
if (checkIgnore($value) ) continue;
if (trim($value) == '') {
echo "line " . ($key + 1) . " contains only space\r\n";
exit;
}
if (preg_match("#@define( +)\\(( +)'[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*'( +),#", $value) !== 0 ) {
echo "line " . ($key + 1) . " contains additional spaces\r\n";
exit;
}
if (getDef($value) === false) {
echo "no definition found in line " . ($key + 1) . ": " . $value . "\r\n";
exit;
}
if (getVal($value) === false) {
echo "no value found in line " . ($key + 1) . ": " . $value . "\r\n";
exit;
}
}
echo "OK\r\n\r\n";

// process single file
if ($lancode != 'all') {
if (empty($argv[2])) {
synclang('', $lancode);
} elseif ($argv[2] == 'UTF-8') {
synclang('UTF-8/', $lancode);
}
} else {
// batch processing all files in folder
$d = @opendir('./');

if (!$d) {
die('Failure');
}

while(($file = readdir($d)) !== false) {
$matches = array();
preg_match('@serendipity_lang_([a-z]{2}[_]*[A-Z]*)\.inc\.php@', $file, $matches);
echo "{$matches[1]}\r\n";
if (empty($matches[1])) continue;
if ($matches[1] == 'en') continue;
echo "syncing language {$matches[1]}\r\n========================\r\n";
synclang('', $matches[1]);
}

$d = @opendir('UTF-8');

if (!$d) {
die('Failure');
}

while(($file = readdir($d)) !== false) {
$matches = array();
preg_match('@serendipity_lang_([a-z]{2}[_]*[A-Z]*)\.inc\.php@', $file, $matches);
if (empty($matches[1])) continue;
echo "syncing language {$matches[1]}\r\n========================\r\n";
synclang('UTF-8/', $matches[1]);
}
}
echo "DONE\r\n";
?>
Loading

0 comments on commit c773b5f

Please sign in to comment.