From 10bccf7d57ddd885507b1a8d4ee29b0076c14724 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 20 Feb 2009 12:57:02 +0300 Subject: automatically extract i18n data from .js files --- utils/extract-i18n-js.pl | 15 +++++++++++++ utils/update-js-translations.sh | 48 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100755 utils/extract-i18n-js.pl create mode 100755 utils/update-js-translations.sh (limited to 'utils') diff --git a/utils/extract-i18n-js.pl b/utils/extract-i18n-js.pl new file mode 100755 index 000000000..d6179fc70 --- /dev/null +++ b/utils/extract-i18n-js.pl @@ -0,0 +1,15 @@ +#!/usr/bin/perl -w +# +use strict; + +while () { + chomp; + + if (/(__|notify_progress|notify|notify_info|notify_error)\(['"](.*?)['"]\)/) { + my $msg = $2; + + $msg =~ s/\"/\\\"/g; + + print "print T_js_decl(\"$msg\");\n"; + } +} diff --git a/utils/update-js-translations.sh b/utils/update-js-translations.sh new file mode 100755 index 000000000..432cf7ece --- /dev/null +++ b/utils/update-js-translations.sh @@ -0,0 +1,48 @@ +#!/bin/sh + +if [ ! -f localized_js.php ]; then + echo "please run this script from tt-rss directory" + exit 1 +fi + +cat >localized_js.php <
+ +var T_messages = new Object(); + +function __(msg) { + if (T_messages[msg]) { + return T_messages[msg]; + } else { + debug('[gettext] not found: ' + msg); + return msg; + } +} + +> localized_js.php + +cat >>localized_js.php <