comparison dwtx/jface/text/templates/TextTemplateMessages.d @ 148:b3dec671d1f7

...
author Frank Benoit <benoit@tionex.de>
date Sun, 24 Aug 2008 22:40:25 +0200
parents 000f9136b8f7
children 77b70cbb4c8d
comparison
equal deleted inserted replaced
147:000f9136b8f7 148:b3dec671d1f7
42 /* 42 /*
43 * @since 3.0 43 * @since 3.0
44 */ 44 */
45 class TextTemplateMessages { 45 class TextTemplateMessages {
46 46
47 private static const String RESOURCE_BUNDLE= TextTemplateMessages.class.getName(); 47 // private static const String RESOURCE_BUNDLE= TextTemplateMessages.class.getName();
48 private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE); 48 private static ResourceBundle fgResourceBundle;//= ResourceBundle.getBundle(RESOURCE_BUNDLE);
49
50 static this() {
51 fgResourceBundle = ResourceBundle.getBundle(
52 getImportData!("dwtx.jface.text.templates.TextTemplateMessages.properties"));
53 }
49 54
50 private this() { 55 private this() {
51 } 56 }
52 57
53 public static String getString(String key) { 58 public static String getString(String key) {
54 try { 59 try {
55 return fgResourceBundle.getString(key); 60 return fgResourceBundle.getString(key);
56 } catch (MissingResourceException e) { 61 } catch (MissingResourceException e) {
57 return '!' + key + '!'; 62 return '!' ~ key ~ '!';
58 } 63 }
59 } 64 }
60 65
61 public static String getFormattedString(String key, Object arg) { 66 public static String getFormattedString(String key, Object[] args... ) {
62 return MessageFormat.format(getString(key), new Object[] { arg });
63 }
64
65
66 public static String getFormattedString(String key, Object[] args) {
67 return MessageFormat.format(getString(key), args); 67 return MessageFormat.format(getString(key), args);
68 } 68 }
69 } 69 }