1 20 package org.enhydra.barracuda.plankton.l10n; 21 22 import java.io.*; 23 import java.util.*; 24 import javax.servlet.*; 25 import javax.servlet.http.*; 26 27 30 public class Localize { 31 32 private static String missingBundle = "[[Missing Bundle]]"; 33 private static String missingKey = "[[Missing Key]]"; 34 private static String missingData = "[[Missing Data]]"; 35 36 44 public static String getString(ResourceBundle rb, String key) { 45 46 if (rb==null) return missingBundle; 48 if (key==null) return missingKey; 49 50 String s = null; 52 try { 53 s = rb.getString(key); 54 } catch (MissingResourceException mre) { 55 mre.printStackTrace(); 56 } 57 58 if (s==null) s = missingData; 60 61 return s.trim(); 63 } 64 65 } 66 | Popular Tags |