comparison dwtx/jface/text/TextMessages.d @ 140:26688fec6d23

Following dsss compile errors
author Frank Benoit <benoit@tionex.de>
date Sun, 24 Aug 2008 03:23:46 +0200
parents 7d818bd32d63
children 000f9136b8f7
comparison
equal deleted inserted replaced
139:93a6ec48fd28 140:26688fec6d23
2 * Copyright (c) 2007, 2008 IBM Corporation and others. 2 * Copyright (c) 2007, 2008 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials 3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0 4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at 5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html 6 * http://www.eclipse.org/legal/epl-v10.html
7 * 7 *
8 * Contributors: 8 * Contributors:
9 * IBM Corporation - initial API and implementation 9 * IBM Corporation - initial API and implementation
10 * Port to the D programming language: 10 * Port to the D programming language:
11 * Frank Benoit <benoit@tionex.de> 11 * Frank Benoit <benoit@tionex.de>
12 *******************************************************************************/ 12 *******************************************************************************/
162 import com.ibm.icu.text.MessageFormat; 162 import com.ibm.icu.text.MessageFormat;
163 163
164 164
165 /** 165 /**
166 * Helper class to get NLSed messages. 166 * Helper class to get NLSed messages.
167 * 167 *
168 * @since 3.4 168 * @since 3.4
169 */ 169 */
170 class TextMessages { 170 class TextMessages {
171 private static final String BUNDLE_NAME= "dwtx.jface.text.TextMessages"; //$NON-NLS-1$ 171 // private static final String BUNDLE_NAME= "dwtx.jface.text.TextMessages"; //$NON-NLS-1$
172 172
173 private static final ResourceBundle RESOURCE_BUNDLE= ResourceBundle.getBundle(BUNDLE_NAME); 173 private static final ResourceBundle RESOURCE_BUNDLE;//= ResourceBundle.getBundle(BUNDLE_NAME);
174
175 static this() {
176 RESOURCE_BUNDLE = ResourceBundle.getBundle(
177 getImportData!("dwtx.jface.text.TextMessages.properties"));
178 }
179
174 180
175 private this() { 181 private this() {
176 } 182 }
177 183
178 public static String getString(String key) { 184 public static String getString(String key) {
179 try { 185 try {
180 return RESOURCE_BUNDLE.getString(key); 186 return RESOURCE_BUNDLE.getString(key);
181 } catch (MissingResourceException e) { 187 } catch (MissingResourceException e) {
182 return '!' + key + '!'; 188 return '!' ~ key ~ '!';
183 } 189 }
184 } 190 }
185
186 public static String getFormattedString(String key, Object arg) {
187 return getFormattedString(key, new Object[] { arg });
188 }
189 191
190 public static String getFormattedString(String key, Object[] args) { 192 public static String getFormattedString(String key, Object[] args...) {
191 return MessageFormat.format(getString(key), args); 193 return MessageFormat.format(getString(key), args);
192 } 194 }
193 195
194 } 196 }