5a2bf5920876a3c3b913f98727d3afd111856a13
[debian/openrocket] / core / src / net / sf / openrocket / l10n / DebugTranslator.java
1 package net.sf.openrocket.l10n;
2
3 /**
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.
7  * 
8  * @author Sampo Niskanen <sampo.niskanen@iki.fi>
9  */
10 public class DebugTranslator implements Translator {
11         
12         private final Translator translator;
13         
14         
15         /**
16          * Sole constructor.
17          * 
18          * @param translator    the translator to verify the translation exists, or <code>null</code> not to verify.
19          */
20         public DebugTranslator(Translator translator) {
21                 this.translator = translator;
22         }
23         
24         
25
26         @Override
27         public String get(String key) {
28                 if (translator != null) {
29                         translator.get(key);
30                 }
31                 return "[" + key + "]";
32         }
33         
34 }