?? messages.java
字號:
/*******************************************************************************
* Copyright (c) 2003 Berthold Daum. All rights reserved. This program and the
* accompanying materials are made available under the terms of the Common
* Public License v1.0 which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors: Berthold Daum
******************************************************************************/
package com.bdaum.SpellChecker.JavaProperties;
import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
public class Messages {
private static final String BUNDLE_NAME = "com.bdaum.SpellChecker.JavaProperties.Messages";
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
.getBundle(BUNDLE_NAME);
/**
* Fetches a message for the specified key
*
* @param key -
* key to be translated
* @return - the message
*/
public static String getString(String key) {
try {
return RESOURCE_BUNDLE.getString(key);
} catch (MissingResourceException e) {
return '!' + key + '!';
}
}
/**
* Fetches a message for the specified key and inserts parameters
*
* @param key -
* key to be translated
* @param params -
* parameters to be inserted into the message
* @return - the message
*/
public static String getString(String key, Object[] params) {
if (params == null)
return getString(key);
try {
return MessageFormat.format(getString(key), params);
} catch (Exception e) {
return "!" + key + "!";
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -