From 7763af389e026f26b71fb2ed3af0bc602767f71d Mon Sep 17 00:00:00 2001 From: kruland2607 Date: Fri, 13 Sep 2013 10:46:35 -0500 Subject: [PATCH] Added little l10n properties analysis tool, and fixed some obvious errors in cs & it localizations. --- core/resources/l10n/messages_cs.properties | 8 +- core/resources/l10n/messages_it.properties | 2 +- .../openrocket/utils/L10nPropertyReport.java | 94 +++++++++++++++++++ 3 files changed, 97 insertions(+), 7 deletions(-) create mode 100644 core/src/net/sf/openrocket/utils/L10nPropertyReport.java diff --git a/core/resources/l10n/messages_cs.properties b/core/resources/l10n/messages_cs.properties index 96751cf89..b3ba6f04e 100644 --- a/core/resources/l10n/messages_cs.properties +++ b/core/resources/l10n/messages_cs.properties @@ -1308,8 +1308,7 @@ PlotConfiguration.Flightside = Letov PlotConfiguration.Stability = Stabilita vs. cas PlotConfiguration.Dragcoef = Brzdící koeficient vs. Machovo císlo PlotConfiguration.Rollcharacteristics = Charakteristiky prícného náklonu -PlotConfiguration.Angleofattack = Úhel nábehu a orientace -vs cas +PlotConfiguration.Angleofattack = Úhel nábehu a orientace vs cas PlotConfiguration.Simulationtime = Simulacní krok a výpocetní cas ! Warning @@ -1582,10 +1581,7 @@ CustomFinImport.errorParsingFile = Chyba behem zpracov CustomFinImport.undo = Importovat sadu volno tvarových stabilizátoru CustomFinImport.error.title = Chyba behem nahrávání profilu stabilizátoru CustomFinImport.error.badimage = Nemohu vyvodit tvar stabilizátoru z obrázku. -CustomFinImport.description = Obrázek bude zmenen na cernobílý -(cerná pro stabilizátor), ujistete se prosím, \u017Ee jste pou\u017Eily cernou barvu na stabilizátor -a bílou nebo svetlou barvu na pozadí. Stabilizátor -se musí dotýkat steny obrázku, která predstavuje uchycení pro stabilizátor. +CustomFinImport.description = Obrázek bude zmenen na cernobílý \n(cerná pro stabilizátor), ujistete se prosím, \u017Ee jste pou\u017Eily cernou barvu na stabilizátor \na bílou nebo svetlou barvu na pozadí. Stabilizátor \nse musí dotýkat steny obrázku, která predstavuje uchycení pro stabilizátor. PresetModel.lbl.select = Výber predvolby: diff --git a/core/resources/l10n/messages_it.properties b/core/resources/l10n/messages_it.properties index e47e7fe9a..a6441d2e6 100644 --- a/core/resources/l10n/messages_it.properties +++ b/core/resources/l10n/messages_it.properties @@ -1350,7 +1350,7 @@ FlightDataType.TYPE_ROLL_FORCING_COEFF = Roll forcing coefficient FlightDataType.TYPE_ROLL_DAMPING_COEFF = Roll damping coefficient FlightDataType.TYPE_PITCH_DAMPING_MOMENT_COEFF = Pitch damping coefficient FlightDataType.TYPE_YAW_DAMPING_MOMENT_COEFF = Yaw damping coefficient -FlightDataType.TYPE_REFERENCE_Lunghezza = Reference lenght +FlightDataType.TYPE_REFERENCE_LENGTH = Reference length FlightDataType.TYPE_REFERENCE_AREA = Reference area FlightDataType.TYPE_ORIENTATION_THETA = Orientazione verticale (zenith) FlightDataType.TYPE_ORIENTATION_PHI = Orientazione laterale (azimuth) diff --git a/core/src/net/sf/openrocket/utils/L10nPropertyReport.java b/core/src/net/sf/openrocket/utils/L10nPropertyReport.java new file mode 100644 index 000000000..3bfced222 --- /dev/null +++ b/core/src/net/sf/openrocket/utils/L10nPropertyReport.java @@ -0,0 +1,94 @@ +package net.sf.openrocket.utils; + +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Properties; + +import net.sf.openrocket.gui.util.SwingPreferences; + +public class L10nPropertyReport { + + public static void main(String[] args) throws Exception { + + Properties english; + + Map langs = new HashMap(); + + System.out.println("Loading All Resource files"); + + english = new Properties(); + InputStream in = L10nPropertyReport.class.getResourceAsStream("/l10n/messages.properties"); + english.load(in); + + System.out.println("en contains " + english.keySet().size()); + + + for (Locale l : SwingPreferences.getSupportedLocales()) { + + String localename = l.getLanguage(); + + if ("en".equals(localename)) { + continue; + } + + Properties p = new Properties(); + + in = L10nPropertyReport.class.getResourceAsStream("/l10n/messages_" + localename + ".properties"); + + p.load(in); + + System.out.println(localename + " contains " + p.keySet().size()); + + langs.put(localename, p); + + } + + // check for languages missing an en key: + + List sortedKeys = getSortedKeys(english); + + for (String key : sortedKeys) { + + List missing = new ArrayList(10); + + for (Map.Entry en : langs.entrySet()) { + if (en.getValue().getProperty(key) != null) { + continue; + } + missing.add(en.getKey()); + } + + if (missing.size() > 0) { + System.out.println(key + " missing from " + missing); + } + + } + + // Check each locale for extra keys: + for (Map.Entry lang : langs.entrySet()) { + System.out.println("Extra keys in " + lang.getKey()); + + sortedKeys = getSortedKeys(lang.getValue()); + for (String key : sortedKeys) { + if (english.getProperty(key) == null) { + System.out.println("\t" + key); + } + } + } + } + + private static List getSortedKeys(Properties p) { + List sortedKeys = new ArrayList(p.keySet().size()); + for (Object obj : p.keySet()) { + sortedKeys.add((String) obj); + } + Collections.sort(sortedKeys); + return sortedKeys; + + } +}