01: /* $Id: TranslationFormat.java 652 2006-01-19 11:12:50Z hengels $ */
02: package org.conform.format;
03:
04: import java.util.*;
05:
06: /**
07: * @version $Revision: 652 $
08: */
09: public class TranslationFormat extends AbstractFormat {
10: Map translations = new HashMap();
11:
12: public String getPattern() {
13: return "%";
14: }
15:
16: public void setPattern(String pattern) {
17: }
18:
19: public String format(Object value) {
20: String text = (String) translations.get(value);
21: if (text != null)
22: return text;
23: return "" + value;
24: }
25:
26: public void addTranslation(Object value, String translation) {
27: translations.put(value, translation);
28: }
29: }
|