20 |
} |
} |
21 |
|
|
22 |
/** |
/** |
23 |
|
* Creates a {@link Translation}<br/> |
24 |
|
* <p> |
25 |
|
* <li>If <code>oneLineCoded</code> is empty or null, NO TRANSLATION is set. |
26 |
|
* <li>If format can't be recognized, the {@link String} is interpreted as |
27 |
|
* the translation in the <code>{@value #DEFAULT_KEY}</code> language |
28 |
|
* |
29 |
|
* @author Stefan Alfons Krüger |
30 |
|
*/ |
31 |
|
public static Translation createFromOneLIne(final String oneLineCoded) { |
32 |
|
Translation result = new Translation(); |
33 |
|
result.fromOneLine(oneLineCoded); |
34 |
|
return result; |
35 |
|
} |
36 |
|
|
37 |
|
/** |
38 |
|
* Returns the Translation to a String of the Format: "de{Baum}en{tree}" <br/> |
39 |
|
* |
40 |
|
* |
41 |
|
* @author Stefan Alfons Krüger |
42 |
|
*/ |
43 |
|
public static String toOneLine(Translation source) { |
44 |
|
StringBuffer oneLine = new StringBuffer(); |
45 |
|
for (String key : source.keySet()) { |
46 |
|
oneLine.append(key + "{" + source.get(key) + "}"); |
47 |
|
} |
48 |
|
return oneLine.toString(); |
49 |
|
} |
50 |
|
|
51 |
|
/** |
52 |
* @author Stefan Alfons Krüger |
* @author Stefan Alfons Krüger |
53 |
* @param code |
* @param code |
54 |
* @return true if the code paramter is a valid ISO Language code |
* @return true if the code paramter is a valid ISO Language code |
76 |
if (l.getLanguage().equals(code.toLowerCase())) { |
if (l.getLanguage().equals(code.toLowerCase())) { |
77 |
return l; |
return l; |
78 |
} |
} |
79 |
// LOGGER.debug(l.getLanguage() + " not = " + code); |
// LOGGER.debug(l.getLanguage() + " not = " + code); |
80 |
} |
} |
81 |
|
|
82 |
LOGGER.error("Can't create a Locale for code " + code |
LOGGER.error("Can't create a Locale for code " + code |