prevent "unchecked conversion" compiler message

+ include "translate" property in xlf "trans-unit" export
pull/51/head
reger 9 years ago
parent f03656394e
commit 06ce9ae711

@ -91,7 +91,7 @@ public class CreateTranslationMasters extends TranslatorXliff {
if (masterOutputFile.exists()) // if file exists, conserve existing master content (may be updated by external tool) if (masterOutputFile.exists()) // if file exists, conserve existing master content (may be updated by external tool)
xliffTrans = TranslatorXliff.loadTranslationsListsFromXliff(masterOutputFile); xliffTrans = TranslatorXliff.loadTranslationsListsFromXliff(masterOutputFile);
else else
xliffTrans = new TreeMap(); xliffTrans = new TreeMap<String, Map<String, String>>();
List<String> lngFiles = Translator.langFiles(new File("locales")); List<String> lngFiles = Translator.langFiles(new File("locales"));
for (String filename : lngFiles) { for (String filename : lngFiles) {

@ -184,9 +184,13 @@ public class TranslatorXliff extends Translator {
for (String source : txtmap.keySet()) { for (String source : txtmap.keySet()) {
String target = txtmap.get(source); String target = txtmap.get(source);
// we use hashCode of source string to get same id in different xliff files for same translation text // we use hashCode of source string to get same id in different xliff files for same translation text
output.write(" <trans-unit id=\"" + Integer.toHexString(source.hashCode()) + "\" xml:space=\"preserve\" approved=\"no\">\n"); output.write(" <trans-unit id=\"" + Integer.toHexString(source.hashCode()) + "\" xml:space=\"preserve\" approved=\"no\"");
output.write(" <source>" + toXmlStr(source) + "</source>\n"); if (target == null || target.isEmpty()) { // omitt target text if not available
if (target != null && !target.isEmpty()) { // omitt target text if not available output.write(" translate=\"yes\">\n");
output.write(" <source>" + toXmlStr(source) + "</source>\n");
} else {
output.write(">\n");
output.write(" <source>" + toXmlStr(source) + "</source>\n");
output.write(" <target" + (target.equals(source) ? "" : " state='translated'") + ">" + toXmlStr(target) + "</target>\n"); output.write(" <target" + (target.equals(source) ? "" : " state='translated'") + ">" + toXmlStr(target) + "</target>\n");
} }
output.write(" </trans-unit>\n"); output.write(" </trans-unit>\n");

Loading…
Cancel
Save