summaryrefslogtreecommitdiff
path: root/utils/update-js-translations.sh
blob: bdac394cb0b1169ae350cc73c819adbee1023268 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/sh

if [ ! -f localized_js.php ]; then
	echo "please run this script from tt-rss directory"
	exit 1
fi

echo "This script is not used anymore."

exit 0 # disabled

cat >localized_js.php <<HEADER
<?php 
error_reporting(E_ERROR | E_WARNING | E_PARSE);
define('DISABLE_SESSIONS', true);

require "functions.php";
header("Content-Type: text/plain; charset=UTF-8");

function T_js_decl(\$s1) {

	if (!\$s1) return;

//	\$T_s1 = __(\$s1);

//	if (\$T_s1 != \$s1) {
		return "T_messages[\"\$s1\"] = \"".__(\$s1)."\";\n";
//	} else {
//		return "";
//	}
}
?>

var T_messages = new Object();

function __(msg) {
	if (T_messages[msg]) {
		return T_messages[msg];
	} else {
		debug('[gettext] not found: ' + msg);
		return msg;
	}
}

<?php
HEADER

cat *js | ./utils/extract-i18n-js.pl | sort | uniq >> localized_js.php

cat >>localized_js.php <<FOOTER
?>
FOOTER