From b6b5093f78de7f90f2c10e520236a6c584c22e59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Mon, 8 Jul 2013 07:08:16 +0000 Subject: 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 --- tools/lpgen/translate.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tools/lpgen/translate.js') 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); -- cgit v1.2.3