From cd15bdeb56eeb8135ad3ac162d10cb5d7d19f9ce Mon Sep 17 00:00:00 2001 From: Basil Date: Thu, 31 Jan 2013 06:27:37 +0000 Subject: - lpgen.js fixed bug with cutting strings, which are ended with '). Now more correct RegExp with \1 using. When string starts with (" than match end as "), not '). - english templates updated with new lpgen.js git-svn-id: http://svn.miranda-ng.org/main/trunk@3377 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- tools/lpgen/lpgen.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'tools/lpgen/lpgen.js') diff --git a/tools/lpgen/lpgen.js b/tools/lpgen/lpgen.js index 8a346e211b..d4d6463ead 100644 --- a/tools/lpgen/lpgen.js +++ b/tools/lpgen/lpgen.js @@ -446,9 +446,8 @@ function ParseSourceFile (SourceFile,array) { if (FSO.GetFile(SourceFile).Size==0) return; //open file sourcefile_stream=FSO.GetFile(SourceFile).OpenAsTextStream(ForReading, TristateUseDefault); - //this is final great regexp ever /(?:LPGENT?|Translate[TW]?|_T)(?:[\s])*?(?:\(['"])([\S\s]*?)(?=["']\x20*?\))/mg - //not store ?: functions LPGEN or LPGENT? or Translate(T or W) or _T, than any unnecessary space \s, than not stored ?: "(" followed by ' or " than \S\s - magic with multiline capture, ending with not stored ?= " or ', than none or few spaces \x20 followed by )/m=multiline g=global - var find= /(?:LPGENT?|Translate[TW]?|_T)(?:[\s])*?(?:\(['"])([\S\s]*?)(?=["'],?\x20*?(?:tmp)?\))/mg; + //not store ?: functions LPGEN or LPGENT? or Translate(T or W) or _T, than any unnecessary space \s, than not stored ?: "(" followed by ' or " (stored and used as \1) than \S\s - magic with multiline capture, ending with not stored ?= \1 (we get " or ' after "("), than none or few spaces \x20 followed by )/m=multiline g=global + var find= /(?:LPGENT?|Translate[TW]?|_T)(?:\s*?\()(['"])([\S\s]*?)(?=\1,?\x20*?(?:tmp)?\))/mg; //comment previous line and uncomment following line to output templates without _T() function in source files. Too many garbage from _T().. //var find= /(?:LPGENT?|Translate[TW]?)(?:[\s])*?(?:\(['"])([\S\s]*?)(?=["'],?\x20*?(?:tmp)?\))/mg; @@ -459,7 +458,7 @@ function ParseSourceFile (SourceFile,array) { //first, init empty var var string; //replace newlines with \r\n in second [1] subregexp ([\S\s]*?), Delphi newlines "'#13#10+" also replace - onestring=string[1].replace(/'?(\#13\#10)*?\+?\r\n(\x20*?\')?/g,"\\r\\n"); + onestring=string[2].replace(/'?(\#13\#10)*?\+?\r\n(\x20*?\')?/g,"\\r\\n"); //remove escape slashes before ' and " stringtolangpack=onestring.replace(/\\(['"])/g,"$1"); //if our string still exist, and length more than 2 symbol (nothing to translate if only two symbols, well, except No and OK, but they are in core. But dozens crap with variables are filtered) -- cgit v1.2.3