summaryrefslogtreecommitdiff
path: root/tools/lpgen/translate.js
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2013-07-08 07:08:16 +0000
committerRobert Pösel <robyer@seznam.cz>2013-07-08 07:08:16 +0000
commitb6b5093f78de7f90f2c10e520236a6c584c22e59 (patch)
treecda20e24487f8ac0146b01108f0225b41b4aac7f /tools/lpgen/translate.js
parent1c9ab00c8340ca93140ba0e508370436d4ec0bb8 (diff)
translate.js: fix for translations beginning with [ (thanks BasiL)
git-svn-id: http://svn.miranda-ng.org/main/trunk@5264 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'tools/lpgen/translate.js')
-rw-r--r--tools/lpgen/translate.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/lpgen/translate.js b/tools/lpgen/translate.js
index ec88980952..1df329398e 100644
--- a/tools/lpgen/translate.js
+++ b/tools/lpgen/translate.js
@@ -296,7 +296,7 @@ stream.LoadFromFile(file);
//read file into var
var translatefiletext=stream.ReadText();
//"find" - RegularExpression, first string have to start with [ and end with]. Next string - translation
-var find=/(^\[.+?\](?=$))\r\n(^(?!\[|;file|\r|\n).+?(?=$))/mg;
+var find=/(^\[.+?\](?=$))\r\n(^(?!;file|\r|\n).+?(?=$))/mg;
//While our "find" RegExp return a results, add strings into dictionary.
while ((string = find.exec(translatefiletext)) != null) {
//first, init empty var
@@ -304,6 +304,9 @@ while ((string = find.exec(translatefiletext)) != null) {
//first match as original string [....], is a key of dictionary, second match is a translation - item of key in dictionary
var key=string[1];
var item=string[2];
+ //ignore "translations" (wrongly parsed untranslated strings) begining and ending with []
+ if (item.match(/^\[.*\]$/))
+ continue;
//add key-item pair into dictionary, if not exists already
if (!dictionary.Exists(key))
dictionary.Add(key,item);