/[schmitzm]/trunk/src/skrueger/i8n/I8NUtil.java
ViewVC logotype

Diff of /trunk/src/skrueger/i8n/I8NUtil.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 142 by alfonx, Mon Jun 15 12:09:05 2009 UTC revision 185 by alfonx, Fri Jul 3 14:36:08 2009 UTC
# Line 20  public class I8NUtil { Line 20  public class I8NUtil {
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
# Line 47  public class I8NUtil { Line 76  public class I8NUtil {
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

Legend:
Removed from v.142  
changed lines
  Added in v.185

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26