From e180da0476b508aa803a164eedef941f54ac863f Mon Sep 17 00:00:00 2001 From: xulihang Date: Tue, 28 Apr 2020 10:24:57 +0800 Subject: [PATCH] replace to for xliff filter --- BasicCAT/BasicCAT.b4j | 30 +++++++++++++++--------------- BasicCAT/BasicCAT.b4j.meta | 4 ++-- BasicCAT/Files/version.txt | 2 +- BasicCAT/xliffFilter.bas | 17 ++++++++++------- 4 files changed, 28 insertions(+), 25 deletions(-) diff --git a/BasicCAT/BasicCAT.b4j b/BasicCAT/BasicCAT.b4j index 5f4e4ff..0f24744 100644 --- a/BasicCAT/BasicCAT.b4j +++ b/BasicCAT/BasicCAT.b4j @@ -184,22 +184,22 @@ Library9=jb4xencryption Module1=FileChooserUtils Module10=preTranslateDialog Module11=xliffFilter -Module12=SRX -Module13=TMX -Module14=LanguageTool -Module15=TMDB -Module16=LanguageUtils -Module17=importDialog -Module18=progressDialog -Module19=TMManager +Module12=XMLUtils +Module13=SRX +Module14=TMX +Module15=LanguageTool +Module16=TMDB +Module17=LanguageUtils +Module18=importDialog +Module19=progressDialog Module2=Project -Module20=TermManager -Module21=statistics -Module22=ClientKVS -Module23=Utils -Module24=MT -Module25=idmlFilter -Module26=XMLUtils +Module20=TMManager +Module21=TermManager +Module22=statistics +Module23=ClientKVS +Module24=Utils +Module25=MT +Module26=idmlFilter Module27=SearchView Module28=idmlUtils Module29=Preferences diff --git a/BasicCAT/BasicCAT.b4j.meta b/BasicCAT/BasicCAT.b4j.meta index 10e7a6b..f44b68f 100644 --- a/BasicCAT/BasicCAT.b4j.meta +++ b/BasicCAT/BasicCAT.b4j.meta @@ -205,6 +205,6 @@ ModuleClosedNodes68= ModuleClosedNodes7= ModuleClosedNodes8= ModuleClosedNodes9= -NavigationStack=TMX,Process_Globals,9,0,TMX,export,223,0,segmentation,segmentedTxtSimpleway,227,0,txtFilter,createWorkFile,5,0,segmentation,segmentedTxt,36,0,xliffFilter,addFromGroups,185,0,xliffFilter,getTransUnits,155,0,XMLUtils,escapedText,54,0,xliffFilter,createWorkFile,17,6,xliffFilter,addTransUnit,226,6 +NavigationStack=xliffFilter,Process_Globals,5,0,xliffFilter,updateTransUnits,493,0,xliffFilter,shouldAddSpace,571,0,xliffFilter,mergeSegment,605,0,XMLUtils,GetElements,38,0,XMLUtils,escapedText,55,6,xliffFilter,createWorkFile,19,6,xliffFilter,checkSegContinuous,354,0,xliffFilter,insertTranslation,355,0,xliffFilter,generateFile,339,0 SelectedBuild=0 -VisibleModules=1,2,3,4,5,6,7,8,9,10,11,26 +VisibleModules=1,2,3,4,5,6,7,8,9,10,11,12 diff --git a/BasicCAT/Files/version.txt b/BasicCAT/Files/version.txt index 081af9a..0a182f2 100644 --- a/BasicCAT/Files/version.txt +++ b/BasicCAT/Files/version.txt @@ -1 +1 @@ -1.7.1 \ No newline at end of file +1.7.2 \ No newline at end of file diff --git a/BasicCAT/xliffFilter.bas b/BasicCAT/xliffFilter.bas index 64c25ef..58b87b6 100644 --- a/BasicCAT/xliffFilter.bas +++ b/BasicCAT/xliffFilter.bas @@ -21,9 +21,10 @@ Sub createWorkFile(filename As String,path As String,sourceLang As String,senten Dim files As List Dim xmlstring As String=File.ReadString(File.Combine(path,"source"),filename) xmlstring=XMLUtils.escapedText(xmlstring,"source","xliff") - xmlstring=XMLUtils.escapedText(xmlstring,"target","xliff") xmlstring=XMLUtils.escapedText(xmlstring,"mrk","xliff") - 'Log("done") + xmlstring=Regex.Replace("",xmlstring,"") + xmlstring=XMLUtils.escapedText(xmlstring,"target","xliff") + Log("escape done") files=getFilesList(xmlstring) @@ -341,8 +342,9 @@ Sub generateFile(filename As String,path As String,projectFile As Map) Dim xmlString As String xmlString=XMLUtils.getXmlFromMapWithoutIndent(insertTranslation(translationMap,filename,path,isSegEnabled)) xmlString=XMLUtils.unescapedText(xmlString,"source","xliff") - xmlString=XMLUtils.unescapedText(xmlString,"target","xliff") xmlString=XMLUtils.unescapedText(xmlString,"seg-source","xliff") + 'xmlString=Regex.Replace("",xmlString,"") + xmlString=XMLUtils.unescapedText(xmlString,"target","xliff") 'Log(xmlString) File.WriteString(File.Combine(path,"target"),filename,xmlString) Main.updateOperation(filename&" generated!") @@ -363,6 +365,7 @@ Sub insertTranslation(translationMap As Map,filename As String,path As String,is xmlstring=XMLUtils.escapedText(xmlstring,"source","xliff") xmlstring=XMLUtils.escapedText(xmlstring,"seg-source","xliff") If isSegEnabled=False Then + xmlstring=Regex.Replace("",xmlstring,"") xmlstring=XMLUtils.escapedText(xmlstring,"target","xliff") End If 'File.WriteString(path,"out.xml",xmlstring) @@ -383,7 +386,7 @@ Sub insertTranslation(translationMap As Map,filename As String,path As String,is Try body=innerFile.Get("body") Catch - Log(LastException) + 'Log(LastException) Continue End Try Dim fileAttributes As Map @@ -497,14 +500,14 @@ Sub updateTransUnits(transUnits As List,originalFilename As String,translationMa End If Else For Each key As String In targetMap.Keys - Log(key) - Log(targetMap) + 'Log(key) + 'Log(targetMap) Try If key<>"Attributes" Then targetMap.Remove(key) End If Catch - Log(LastException) + 'Log(LastException) End Try Next targetMap.Put("Text",dataMap.Get("translation"))