1 package net.sf.openrocket.l10n;
4 * A translator implementation that returns the logical key in brackets instead
5 * of an actual translation. The class optionally verifies that the translation
6 * is actually obtainable from some other translator.
8 * @author Sampo Niskanen <sampo.niskanen@iki.fi>
10 public class DebugTranslator implements Translator {
12 private final Translator translator;
18 * @param translator the translator to verify the translation exists, or <code>null</code> not to verify.
20 public DebugTranslator(Translator translator) {
21 this.translator = translator;
27 public String get(String key) {
28 if (translator != null) {
31 return "[" + key + "]";
37 public String get(String base, String text) {
38 return "[" + base + ":" + text + "]";
44 public String getBaseText(String base, String translation) {
45 if (translation.startsWith("[" + base + ":") && translation.endsWith("]")) {
46 return translation.substring(base.length() + 2, translation.length() - 1);