@@ -114,7 +114,8 @@ private static void mergeXliff(String src, String xliff, boolean unapproved, boo
114114 throw new IOException (Messages .getString ("MergeXliff.6" ));
115115 }
116116 xliffFile = processFiles (xliffFile , doc , tgtLang );
117- List <String > result = Merge .merge (xliffFile .getAbsolutePath (), src , catalog .getAbsolutePath (), unapproved );
117+ String target = getTarget (src , xliffFile .getAbsolutePath ());
118+ List <String > result = Merge .merge (xliffFile .getAbsolutePath (), target , catalog .getAbsolutePath (), unapproved );
118119 if (Constants .ERROR .equals (result .get (0 ))) {
119120 throw new IOException (result .get (1 ));
120121 }
@@ -133,6 +134,18 @@ private static void mergeXliff(String src, String xliff, boolean unapproved, boo
133134 }
134135 }
135136
137+ private static String getTarget (String src , String xliff ) throws SAXException , IOException , ParserConfigurationException {
138+ SAXBuilder builder = new SAXBuilder ();
139+ Document doc = builder .build (xliff );
140+ List <Element > files = doc .getRootElement ().getChildren ("file" );
141+ if (files .size () != 1 ) {
142+ return src ;
143+ }
144+ String original = files .get (0 ).getAttributeValue ("original" );
145+ File target = new File (new File (src ), original );
146+ return target .getAbsolutePath ();
147+ }
148+
136149 private static File processFiles (File xliffFile , Document doc , String tgtLang ) throws IOException {
137150 Element root = doc .getRootElement ();
138151 List <Element > files = root .getChildren ("file" );
0 commit comments