l10n updates

This commit is contained in:
Sampo Niskanen 2011-07-20 15:44:57 +00:00
parent 8d2c5fd6e7
commit 27caf60161
10 changed files with 363 additions and 244 deletions

View File

@ -144,6 +144,9 @@ debuglogdlg.col.Message = Message
debuglogdlg.lbl.Loglinenbr = Log line number: debuglogdlg.lbl.Loglinenbr = Log line number:
debuglogdlg.lbl.Time = Time: debuglogdlg.lbl.Time = Time:
debuglogdlg.lbl.Level = Level: debuglogdlg.lbl.Level = Level:
debuglogdlg.lbl.Location = Location:
debuglogdlg.lbl.Logmessage = Log message:
debuglogdlg.lbl.Stacktrace = Stack trace:
! Edit Motor configuration dialog ! Edit Motor configuration dialog
@ -485,6 +488,7 @@ componentanalysisdlg.println.settingnam = SETTING NAN VALUES
componentanalysisdlg.lbl.reflenght = Reference length: componentanalysisdlg.lbl.reflenght = Reference length:
componentanalysisdlg.lbl.refarea = Reference area: componentanalysisdlg.lbl.refarea = Reference area:
!componentanalysisdlg.But.close =Close !componentanalysisdlg.But.close =Close
componentanalysisdlg.TabStability.Col.Component = Component
! Custom Material dialog ! Custom Material dialog
custmatdlg.title.Custommaterial = Custom material custmatdlg.title.Custommaterial = Custom material
@ -754,6 +758,7 @@ ParachuteCfg.tab.ttip.Radialpos = Radial position configuration
ParachuteCfg.lbl.Radialdistance = Radial distance: ParachuteCfg.lbl.Radialdistance = Radial distance:
ParachuteCfg.lbl.Radialdirection = Radial direction: ParachuteCfg.lbl.Radialdirection = Radial direction:
ParachuteCfg.but.Reset = Reset ParachuteCfg.but.Reset = Reset
ParachuteCfg.lbl.plusdelay = plus
! ShockCordConfig ! ShockCordConfig
ShockCordCfg.lbl.Shockcordlength = Shock cord length ShockCordCfg.lbl.Shockcordlength = Shock cord length
@ -799,6 +804,7 @@ StreamerCfg.tab.ttip.Radialpos = Radial position configuration
StreamerCfg.lbl.Radialdistance = Radial distance: StreamerCfg.lbl.Radialdistance = Radial distance:
StreamerCfg.lbl.Radialdirection = Radial direction: StreamerCfg.lbl.Radialdirection = Radial direction:
StreamerCfg.but.Reset = Reset StreamerCfg.but.Reset = Reset
StreamerCfg.lbl.plusdelay = plus
! ThicknessRingComponentConfig ! ThicknessRingComponentConfig
ThicknessRingCompCfg.tab.Outerdiam = Outer diameter: ThicknessRingCompCfg.tab.Outerdiam = Outer diameter:

13
scripts/checkTranslations.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
#
# Perform all tests for the translation files.
#
# Usage:
# ./scripts/checkTranslations.sh
#
# Test that keys used in Java files are present in English messages
find src/ -name "*.java" -exec ./scripts/verifyTranslationKeys.pl l10n/messages.properties {} +

View File

@ -0,0 +1,31 @@
#!/bin/bash
#
# Rename translation keys in translation files.
#
# Usage:
# renameTranslationKeys.sh <mapping files...>
#
# The mapping files contain "<original> <new>" key pairs.
# Empty lines and lines starting with "#" are ignored.
# All translation files are modified at once.
#
TRANSLATIONS=messages*.properties
cat "$@" | while read line; do
if echo "$line" | grep -q "^\s*$\|^\s*#"; then
continue
fi
if ! echo "$line" | egrep -q "^\s*[a-zA-Z0-9._-]+\s+[a-zA-Z0-9._-]+\s*$"; then
echo "Invalid line: $line"
fi
from="`echo $line | cut -d" " -f1`"
to="`echo $line | cut -d" " -f2`"
sed -i "s/^${from}\s*=\s*/${to} = /" $TRANSLATIONS
done

View File

@ -0,0 +1,67 @@
#!/usr/bin/perl
#
# Verify that keys used in Java files are present in the translation file.
#
# Usage:
# verifyTranslationKeys.pl <property file> <Java files...>
#
# For example:
# find src/ -name "*.java" -exec ./scripts/verifyTranslationKeys.pl l10n/messages.properties {} +
#
# Read the translation file
my %keys;
print "Reading translation keys...\n";
while ($str = <>) {
if ($ARGV!~/\.properties/) {
last;
}
if ($str=~/^\s*($|[#!])/) {
next;
}
if ($str=~/^([a-zA-Z0-9._-]+)\s*=/) {
$keys{$1} = 1;
} else {
print "ERROR: Invalid line in $ARGV: $str";
}
}
# Read Java files
my $oldFile = $ARGV;
my $class="";
print "Reading Java files...\n";
while ($str = <>) {
# Check for new file
if ($ARGV != $oldFile) {
$class = "";
}
# Check for irregular translator definition (exclude /l10n/ and /startup/)
if ($str =~ / Translator / &&
$str !~ /private static final Translator trans = Application.getTranslator\(\);/ &&
$ARGV !~ /\/(l10n|startup)\//) {
print "ERROR: Unusual translator usage in file $ARGV: $str";
}
# Check for new class definition
if ($str =~ /^[\sa-z]*class ([a-zA-Z0-9]+) /) {
$class = $1;
}
# Check for translator usage
if ($str =~ /trans\.get\(\"([^\"]+)\"\)/) {
$key = $1;
if (!(exists $keys{$key}) &&
!(exists $keys{$class . "." . $key})) {
print "ERROR: Missing translation for '$key' in file $ARGV\n";
}
}
}

View File

@ -17,6 +17,7 @@ import net.sf.openrocket.startup.Application;
public class StageSelector extends JPanel implements ChangeListener { public class StageSelector extends JPanel implements ChangeListener {
private static final Translator trans = Application.getTranslator();
private final Configuration configuration; private final Configuration configuration;
@ -64,7 +65,6 @@ public class StageSelector extends JPanel implements ChangeListener {
private class StageAction extends AbstractAction implements ChangeListener { private class StageAction extends AbstractAction implements ChangeListener {
private final int stage; private final int stage;
private final Translator trans = Application.getTranslator();
public StageAction(final int stage) { public StageAction(final int stage) {
this.stage = stage; this.stage = stage;

View File

@ -23,8 +23,8 @@ import net.sf.openrocket.gui.components.UnitSelector;
import net.sf.openrocket.l10n.Translator; import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.material.Material; import net.sf.openrocket.material.Material;
import net.sf.openrocket.rocketcomponent.MassComponent; import net.sf.openrocket.rocketcomponent.MassComponent;
import net.sf.openrocket.rocketcomponent.RocketComponent;
import net.sf.openrocket.rocketcomponent.MotorMount.IgnitionEvent; import net.sf.openrocket.rocketcomponent.MotorMount.IgnitionEvent;
import net.sf.openrocket.rocketcomponent.RocketComponent;
import net.sf.openrocket.startup.Application; import net.sf.openrocket.startup.Application;
import net.sf.openrocket.unit.UnitGroup; import net.sf.openrocket.unit.UnitGroup;

View File

@ -2,6 +2,7 @@
* OpenRocketPrintable.java * OpenRocketPrintable.java
*/ */
package net.sf.openrocket.gui.print; package net.sf.openrocket.gui.print;
import net.sf.openrocket.l10n.Translator; import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.startup.Application; import net.sf.openrocket.startup.Application;
@ -18,6 +19,8 @@ public enum OpenRocketPrintable {
//// Design Report //// Design Report
DESIGN_REPORT("OpenRocketPrintable.DesignReport", false, 3); DESIGN_REPORT("OpenRocketPrintable.DesignReport", false, 3);
private static final Translator trans = Application.getTranslator();
/** /**
* The description - will be displayed in the JTree. * The description - will be displayed in the JTree.
*/ */
@ -52,7 +55,6 @@ public enum OpenRocketPrintable {
* @return a displayable string * @return a displayable string
*/ */
public String getDescription() { public String getDescription() {
final Translator trans = Application.getTranslator();
return trans.get(description); return trans.get(description);
} }

View File

@ -1,13 +1,13 @@
package net.sf.openrocket.rocketcomponent; package net.sf.openrocket.rocketcomponent;
import java.util.List;
import net.sf.openrocket.l10n.Translator; import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.material.Material; import net.sf.openrocket.material.Material;
import net.sf.openrocket.startup.Application; import net.sf.openrocket.startup.Application;
import net.sf.openrocket.unit.UnitGroup; import net.sf.openrocket.unit.UnitGroup;
import net.sf.openrocket.util.Prefs; import net.sf.openrocket.util.Prefs;
import java.util.List;
/** /**
* Class of components with well-defined physical appearance and which have an effect on * Class of components with well-defined physical appearance and which have an effect on
* aerodynamic simulation. They have material defined for them, and the mass of the component * aerodynamic simulation. They have material defined for them, and the mass of the component
@ -30,6 +30,7 @@ public abstract class ExternalComponent extends RocketComponent {
//// Polished //// Polished
POLISHED("ExternalComponent.Polished", 2e-6); POLISHED("ExternalComponent.Polished", 2e-6);
private static final Translator trans = Application.getTranslator();
private final String name; private final String name;
private final double roughnessSize; private final double roughnessSize;
@ -44,7 +45,6 @@ public abstract class ExternalComponent extends RocketComponent {
@Override @Override
public String toString() { public String toString() {
final Translator trans = Application.getTranslator();
return trans.get(name) + " (" + UnitGroup.UNITS_ROUGHNESS.toStringUnit(roughnessSize) + ")"; return trans.get(name) + " (" + UnitGroup.UNITS_ROUGHNESS.toStringUnit(roughnessSize) + ")";
} }
} }

View File

@ -8,11 +8,10 @@ import net.sf.openrocket.util.ChangeSource;
import net.sf.openrocket.util.Coordinate; import net.sf.openrocket.util.Coordinate;
public interface MotorMount extends ChangeSource { public interface MotorMount extends ChangeSource {
static final Translator trans = Application.getTranslator();
public static enum IgnitionEvent { public static enum IgnitionEvent {
//// Automatic (launch or ejection charge) //// Automatic (launch or ejection charge)
AUTOMATIC(trans.get("MotorMount.IgnitionEvent.AUTOMATIC")) { AUTOMATIC("MotorMount.IgnitionEvent.AUTOMATIC") {
@Override @Override
public boolean isActivationEvent(FlightEvent e, RocketComponent source) { public boolean isActivationEvent(FlightEvent e, RocketComponent source) {
int count = source.getRocket().getStageCount(); int count = source.getRocket().getStageCount();
@ -26,14 +25,14 @@ public interface MotorMount extends ChangeSource {
} }
}, },
//// Launch //// Launch
LAUNCH(trans.get("MotorMount.IgnitionEvent.LAUNCH")) { LAUNCH("MotorMount.IgnitionEvent.LAUNCH") {
@Override @Override
public boolean isActivationEvent(FlightEvent e, RocketComponent source) { public boolean isActivationEvent(FlightEvent e, RocketComponent source) {
return (e.getType() == FlightEvent.Type.LAUNCH); return (e.getType() == FlightEvent.Type.LAUNCH);
} }
}, },
//// First ejection charge of previous stage //// First ejection charge of previous stage
EJECTION_CHARGE(trans.get("MotorMount.IgnitionEvent.EJECTION_CHARGE")) { EJECTION_CHARGE("MotorMount.IgnitionEvent.EJECTION_CHARGE") {
@Override @Override
public boolean isActivationEvent(FlightEvent e, RocketComponent source) { public boolean isActivationEvent(FlightEvent e, RocketComponent source) {
if (e.getType() != FlightEvent.Type.EJECTION_CHARGE) if (e.getType() != FlightEvent.Type.EJECTION_CHARGE)
@ -45,7 +44,7 @@ public interface MotorMount extends ChangeSource {
} }
}, },
//// First burnout of previous stage //// First burnout of previous stage
BURNOUT(trans.get("MotorMount.IgnitionEvent.BURNOUT")) { BURNOUT("MotorMount.IgnitionEvent.BURNOUT") {
@Override @Override
public boolean isActivationEvent(FlightEvent e, RocketComponent source) { public boolean isActivationEvent(FlightEvent e, RocketComponent source) {
if (e.getType() != FlightEvent.Type.BURNOUT) if (e.getType() != FlightEvent.Type.BURNOUT)
@ -57,7 +56,7 @@ public interface MotorMount extends ChangeSource {
} }
}, },
//// Never //// Never
NEVER(trans.get("MotorMount.IgnitionEvent.NEVER")) { NEVER("MotorMount.IgnitionEvent.NEVER") {
@Override @Override
public boolean isActivationEvent(FlightEvent e, RocketComponent source) { public boolean isActivationEvent(FlightEvent e, RocketComponent source) {
return false; return false;
@ -66,6 +65,7 @@ public interface MotorMount extends ChangeSource {
; ;
private static final Translator trans = Application.getTranslator();
private final String description; private final String description;
IgnitionEvent(String description) { IgnitionEvent(String description) {
@ -76,7 +76,7 @@ public interface MotorMount extends ChangeSource {
@Override @Override
public String toString() { public String toString() {
return description; return trans.get(description);
} }
}; };

View File

@ -21,23 +21,23 @@ public enum LineStyle {
//// Dotted //// Dotted
DOTTED("LineStyle.Dotted", new float[] { 2f, 3f }), DOTTED("LineStyle.Dotted", new float[] { 2f, 3f }),
//// Dash-dotted //// Dash-dotted
DASHDOT("LineStyle.Dash-dotted",new float[] { 8f, 3f, 2f, 3f}) DASHDOT("LineStyle.Dash-dotted", new float[] { 8f, 3f, 2f, 3f });
;
private static final Translator trans = Application.getTranslator();
private final String name; private final String name;
private final float[] dashes; private final float[] dashes;
LineStyle(String name, float[] dashes) { LineStyle(String name, float[] dashes) {
this.name = name; this.name = name;
this.dashes = dashes; this.dashes = dashes;
} }
public float[] getDashes() { public float[] getDashes() {
return Arrays.copyOf(dashes, dashes.length); return Arrays.copyOf(dashes, dashes.length);
} }
@Override @Override
public String toString() { public String toString() {
final Translator trans = Application.getTranslator();
return trans.get(name); return trans.get(name);
} }
} }