error messages concerning the user account now look sth like this:

An error occurred when ... in the following user account: User name: <username>,
Server name: <server>.

i18n messages now allow more than one parameter to be set
cusax-fix
Yana Stamcheva 19 years ago
parent fb5e76320e
commit b8ef9bdf9a

@ -7,6 +7,7 @@
package net.java.sip.communicator.impl.gui.i18n;
import java.text.*;
import java.util.*;
/**
* The Messages class manages the access to the internationalization
@ -62,7 +63,7 @@ public static I18NString getI18NString(String key) {
* @return An internationalized string corresponding to the given key,
* by replacing all occurences of '?' with the given string param.
*/
public static I18NString getI18NString(String key, String param) {
public static I18NString getI18NString(String key, String[] params) {
I18NString i18nString = new I18NString();
@ -70,8 +71,8 @@ public static I18NString getI18NString(String key, String param) {
try {
resourceString = RESOURCE_BUNDLE.getString(key);
resourceString = resourceString.replaceAll("\\?", param);
resourceString = MessageFormat.format(resourceString, params);
int mnemonicIndex = resourceString.indexOf('&');

@ -6,16 +6,16 @@ accounts=Accounts
activateOnlyWhenMinimized=Activate only when minimized
add=&Add
addContact=&Add contact
addContactError=Failed to add contact with id: ?
addContactError=Failed to add contact with id: {0}
addContactErrorTitle=Add contact Error
addContactExistError=The contact ? already exists in your contact list.
addContactExistError=The contact {0} already exists in your contact list.
addContactIdentifier=In the field below enter the identifier of the contact you would like to add.
addContactWizard=Add contact wizard
addGroupLocalError=Failed to add group with name: ?. The problem occured during a local IO operation.
addGroupNetError=Failed to add group with name: ?. The problem occured due to a network failure. Please check your network connection and try again.
addGroupError=Failed to add group with name: ?.
addGroupLocalError=Failed to add group with name: {0}. The problem occured during a local IO operation.
addGroupNetError=Failed to add group with name: {0}. The problem occured due to a network failure. Please check your network connection and try again.
addGroupError=Failed to add group with name: {0}.
addGroupErrorTitle=Add group Error
addGroupExistError=The group ? already exists in your contact list.
addGroupExistError=The group {0} already exists in your contact list.
addSubcontact=&Add subcontact
all=&All
allContacts=&All contacts
@ -27,8 +27,8 @@ authAccepted=contact has accepted your authorization request.
authenticationWindowTitle=Authentication requested
authRejected=contact has rejected your authorization request.
authorizationRequested=Authorization requested
authorizationRequestedInfo=The ? contact requests your authorization.
authenticationFailed=The authentication for account ? failed. The password you entered is not valid.
authorizationRequestedInfo=The {0} contact requests your authorization.
authenticationFailed=The authentication failed for the following account: User name: {0}, Server name: {1}. The password you entered is not valid.
authorizationResponse=Authorization response
autoPopup=Bring window to front
back=&Back
@ -42,11 +42,11 @@ conference=Conference
configure=&Configure
configuration=Configuration
connectionFailed=Connection failed
connectionFailedMessage=Connection for account ? failed.
connectionExpiredMessage=You are currently disconnected from the ? server.
contactNotSupportingTelephony=The choosen ? contact doesn't support telephony.
contactPausedTyping=? paused typing the message
contactTyping=? is typing a message
connectionFailedMessage=Connection failed for the following account: User name: {0}, Server name: {1}.
connectionExpiredMessage=You are currently disconnected from the {0} server.
contactNotSupportingTelephony=The choosen {0} contact doesn't support telephony.
contactPausedTyping={0} paused typing the message
contactTyping={0} is typing a message
contactTypingStateStale=typing state not updated
contacts=Contacts
continue=&Continue
@ -80,7 +80,7 @@ font=Font
help=?
hideCallPanel=&Hide call panel
history=&History
historyContact=History - ?
historyContact=History - {0}
hour=Hour
identifier=Identifier
ignore=Ignore
@ -89,11 +89,11 @@ invalidCall=Invalid call
last=Last
launchBrowserError=Error attempting to launch web browser.
launchOnStartUp=Launch on start up
limitReachedForIp=You have too many existing registrations from the local IP address and the ? server doesn't allow to open any more of them.
limitReachedForIp=You have too many existing registrations from the local IP address and the {0} server doesn't allow to open any more of them.
login=&Login
loginNotSucceeded=An error occured while logging in with ? account.
loginWindowTitle=Login ?
logoffNotSucceeded=An error occured while logging off with ? account.
loginNotSucceeded=An error occured while logging in with the following account: User name: {0}, Server name: {1}.
loginWindowTitle=Login {0}
logoffNotSucceeded=An error occured while logging off with the following account: User name: {0}, Server name: {1}.
me=me
modify=&Modify
moveSubcontactMsg=Select the contact, where you would like to move.
@ -105,7 +105,7 @@ msgDeliveryOfflineNotSupported=The protocol you are using doesn't support offlin
msgDeliveryInternalError=An internal error occured. This is most probably a bug. Please report it here: http://www.sip-communicator.org/index.php/Development/BugsAndIssues
msgNotDelivered=A network problem occured.
msgSendConnectionProblem=You should be connected to be able to send messages.
multipleLogins=You have logged in more than once with the same account. ? account is currently disconnected.
multipleLogins=You have logged in more than once with the same account. The following account: User name: {0}, Server name: {1} is currently disconnected.
name=Name
networkFailure=Network failure
next=&Next
@ -115,7 +115,7 @@ newName=New name:
no=No
noAccountFound=In order to use the SIP-Communicator you need at least one registered account. The following pages will guide you through the process of creating an account.
nonEmptyChatWindowClose=You're trying to close a chat with a non-sent message. Are you sure you want to close this chat?
nonExistingUserId=The ? server does not recognize specified user id.
nonExistingUserId=The {0} server does not recognize specified user id.
notifications=Notifications
ok=&OK
offline=Offline
@ -130,7 +130,7 @@ protocol=Protocol
providerNotConnected=You must be connected to be able to communicate.
quit=&Quit
ready=Ready
reconnectionLimitExceeded=You have have been disconnecting and reconnecting to the server too fast. ? account is temporarily banned and would have to wait a bit before trying to login again.
reconnectionLimitExceeded=You have have been disconnecting and reconnecting to the server too fast. The following account: User name: {0}, Server name: {1} is temporarily banned and would have to wait a bit before trying to login again.
refresh=Refresh
registrationTimeout=Registration timeout:
reject=&Reject
@ -147,13 +147,13 @@ renameGroup=Re&name group
renameGroupInfo=In the field below you can specify the name you would like to use for the given group.
request=&Request
requestAuthorization=&Request authorization
requestAuthorizationInfo=Can't add ? to your Contact List. ? must authorize your request to add him/her. Please enter your request below.
requestAuthorizationInfo=Can't add {0} to your Contact List. {0} must authorize your request to add him/her. Please enter your request below.
requestAuthReason=Request reason
requestAuthReasonEnter=Enter request reason
responseAuthReasonEnter=Enter response reason
save=&Save
search=&Search
securityAuthorityRealm=The ? server has requested your authentication.
securityAuthorityRealm=The {0} server has requested your authentication.
selectAccount=Select account
selectAccountRegistration=From the list below select the account registration wizard to use for creating a new account.
selectAccountRegWizardTitle=Select account registration
@ -173,9 +173,9 @@ showCallPanel=Show call panel
showOfflineUsers=Hide/Show offline users
sipCommunicator=SIPCommunicator
soundOnOff=Turn sound on/off
statusChangedChatMessage=has become ?
statusChangeGeneralError=Failed to change status for ? account due to a general error.
statusChangeNetworkFailure=Failed to change status for ? account due to a network problem.
statusChangedChatMessage=has become {0}
statusChangeGeneralError=Failed to change status for account: User name: {0}, Server name: {1}, due to a general error.
statusChangeNetworkFailure=Failed to change status for account: User name: {0}, Server name: {1}, due to a network problem.
summary=Summary
today=Today
tools=&Tools
@ -183,7 +183,7 @@ typeYourRequest=Type your request here
uin=UIN:
unknown=Unknown user
msgDeliveryFailedUnknownError=Unknown error has occured while delivering your message.
unregisteredMessage=Unable to connect ? account. You are currently offline.
unregisteredMessage=Unable to connect the following account: User name: {0}, Server name: {1}. You are currently offline.
updateAutomatically=Automatically install new updates
updates=Updates
userInfo=&User info

@ -93,7 +93,7 @@ public AuthorizationRequestedDialog(MainFrame mainFrame, Contact contact,
titleLabel.setText(title);
infoTextArea.setText(Messages.getI18NString("authorizationRequestedInfo",
contact.getDisplayName()).getText());
new String[]{contact.getDisplayName()}).getText());
this.infoTextArea.setFont(Constants.FONT.deriveFont(Font.BOLD, 12f));
this.infoTextArea.setLineWrap(true);

@ -93,7 +93,7 @@ public RequestAuthorizationDialog(MainFrame mainFrame, Contact contact,
this.request = request;
infoTextArea.setText(Messages.getI18NString("requestAuthorizationInfo",
contact.getDisplayName()).getText());
new String[]{contact.getDisplayName()}).getText());
this.infoTextArea.setFont(Constants.FONT.deriveFont(Font.BOLD, 12f));
this.infoTextArea.setLineWrap(true);

@ -235,7 +235,8 @@ else if(selectedPanel != null
new ErrorDialog(this.mainFrame,
Messages.getI18NString(
"contactNotSupportingTelephony",
contact.getDisplayName()).getText(),
new String[]{contact.getDisplayName()})
.getText(),
Messages.getI18NString("warning").getText())
.showDialog();
}

@ -479,27 +479,33 @@ public void typingNotificationReceifed(TypingNotificationEvent evt)
MetaContact metaContact = mainFrame.getContactList()
.findMetaContactByContact(evt.getSourceContact());
if (typingState == OperationSetTypingNotifications.STATE_TYPING) {
if (typingState == OperationSetTypingNotifications.STATE_TYPING)
{
notificationMsg
= Messages.getI18NString("contactTyping", contactName).getText();
= Messages.getI18NString("contactTyping",
new String[]{contactName}).getText();
typingTimer.setMetaContact(metaContact);
typingTimer.start();
}
else if (typingState == OperationSetTypingNotifications.STATE_PAUSED) {
else if (typingState == OperationSetTypingNotifications.STATE_PAUSED)
{
notificationMsg = Messages.getI18NString("contactPausedTyping",
contactName).getText();
new String[]{contactName}).getText();
typingTimer.setMetaContact(metaContact);
typingTimer.start();
}
else if (typingState == OperationSetTypingNotifications.STATE_STOPPED) {
else if (typingState == OperationSetTypingNotifications.STATE_STOPPED)
{
notificationMsg = "";
}
else if (typingState == OperationSetTypingNotifications.STATE_STALE) {
else if (typingState == OperationSetTypingNotifications.STATE_STALE)
{
notificationMsg
= Messages.getI18NString("contactTypingStateStale").getText();
}
else if (typingState == OperationSetTypingNotifications.STATE_UNKNOWN) {
else if (typingState == OperationSetTypingNotifications.STATE_UNKNOWN)
{
// TODO: Implement state unknown
}
this.setChatNotificationMsg(metaContact, notificationMsg);

@ -168,7 +168,7 @@ public void run() {
new ErrorDialog(mainFrame,
Messages.getI18NString(
"addContactExistError",
uin).getText(),
new String[]{uin}).getText(),
ex,
Messages.getI18NString(
"addContactErrorTitle").getText())
@ -181,7 +181,7 @@ else if (errorCode
new ErrorDialog(mainFrame,
Messages.getI18NString(
"addContactError",
uin).getText(),
new String[]{uin}).getText(),
ex,
Messages.getI18NString(
"addContactErrorTitle").getText())
@ -194,7 +194,7 @@ else if (errorCode
new ErrorDialog(mainFrame,
Messages.getI18NString(
"addContactError",
uin).getText(),
new String[]{uin}).getText(),
ex,
Messages.getI18NString(
"addContactErrorTitle").getText())
@ -205,7 +205,7 @@ else if (errorCode
new ErrorDialog(mainFrame,
Messages.getI18NString(
"addContactError",
uin).getText(),
new String[]{uin}).getText(),
ex,
Messages.getI18NString(
"addContactErrorTitle").getText())

@ -100,7 +100,7 @@ public void run() {
new ErrorDialog(mainFrame,
Messages.getI18NString(
"addContactExistError",
newContact.getUin()).getText(),
new String[]{newContact.getUin()}).getText(),
ex,
Messages.getI18NString(
"addContactErrorTitle").getText())
@ -112,7 +112,7 @@ else if (errorCode
new ErrorDialog(mainFrame,
Messages.getI18NString(
"addContactError",
newContact.getUin()).getText(),
new String[]{newContact.getUin()}).getText(),
ex,
Messages.getI18NString(
"addContactErrorTitle").getText())
@ -122,24 +122,24 @@ else if (errorCode
== MetaContactListException.CODE_NETWORK_ERROR) {
new ErrorDialog(mainFrame,
Messages.getI18NString(
"addContactError",
newContact.getUin()).getText(),
ex,
Messages.getI18NString(
"addContactErrorTitle").getText())
.showDialog();
Messages.getI18NString(
"addContactError",
new String[]{newContact.getUin()}).getText(),
ex,
Messages.getI18NString(
"addContactErrorTitle").getText())
.showDialog();
}
else {
new ErrorDialog(mainFrame,
Messages.getI18NString(
"addContactError",
newContact.getUin()).getText(),
ex,
Messages.getI18NString(
"addContactErrorTitle").getText())
.showDialog();
Messages.getI18NString(
"addContactError",
new String[]{newContact.getUin()}).getText(),
ex,
Messages.getI18NString(
"addContactErrorTitle").getText())
.showDialog();
}
}
}

@ -134,7 +134,7 @@ public void run() {
new ErrorDialog(mainFrame,
Messages.getI18NString(
"addGroupExistError",
groupName).getText(),
new String[]{groupName}).getText(),
ex,
Messages.getI18NString(
"addGroupErrorTitle").getText())
@ -146,7 +146,7 @@ else if (errorCode
new ErrorDialog(mainFrame,
Messages.getI18NString(
"addGroupLocalError",
groupName).getText(),
new String[]{groupName}).getText(),
ex,
Messages.getI18NString(
"addGroupErrorTitle").getText())
@ -158,7 +158,7 @@ else if (errorCode
new ErrorDialog(mainFrame,
Messages.getI18NString(
"addGroupNetError",
groupName).getText(),
new String[]{groupName}).getText(),
ex,
Messages.getI18NString(
"addGroupErrorTitle").getText())
@ -169,7 +169,7 @@ else if (errorCode
new ErrorDialog(mainFrame,
Messages.getI18NString(
"addGroupError",
groupName).getText(),
new String[]{groupName}).getText(),
ex,
Messages.getI18NString(
"addGroupErrorTitle").getText())

@ -137,8 +137,8 @@ private void init() {
this.realmTextArea.setFont(Constants.FONT.deriveFont(Font.BOLD, 12f));
this.realmTextArea.setEditable(false);
this.realmTextArea.setText(
Messages.getI18NString("securityAuthorityRealm", this.realm)
.getText());
Messages.getI18NString("securityAuthorityRealm",
new String[]{realm}).getText());
this.uinLabel.setFont(Constants.FONT.deriveFont(Font.BOLD));
this.passwdLabel.setFont(Constants.FONT.deriveFont(Font.BOLD));

@ -205,6 +205,8 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt)
{
ProtocolProviderService protocolProvider = evt.getProvider();
AccountID accountID = protocolProvider.getAccountID();
logger.trace("Protocol provider: " + protocolProvider
+ " changed its state to: " + evt.getNewState().getStateName());
@ -238,7 +240,10 @@ else if (evt.getNewState().equals(
String msgText = Messages.getI18NString(
"reconnectionLimitExceeded",
protocolProvider.getAccountID().getUserID()).getText();
new String []{
accountID.getUserID(),
accountID.getService()
}).getText();
new ErrorDialog(null, msgText,
Messages.getI18NString("error").getText()).showDialog();
@ -247,17 +252,21 @@ else if (evt.getReasonCode() == RegistrationStateChangeEvent
.REASON_NON_EXISTING_USER_ID) {
String msgText = Messages.getI18NString(
"nonExistingUserId", protocolProvider
.getProtocolName()).getText();
"nonExistingUserId",
new String[]{protocolProvider.getProtocolName()}).getText();
new ErrorDialog(null, msgText,
Messages.getI18NString("error").getText()).showDialog();
}
else if (evt.getReasonCode() == RegistrationStateChangeEvent
.REASON_AUTHENTICATION_FAILED) {
String msgText = Messages.getI18NString("authenticationFailed",
protocolProvider.getAccountID().getUserID())
.getText();
.REASON_AUTHENTICATION_FAILED)
{
String msgText = Messages.getI18NString(
"authenticationFailed",
new String[]{
accountID.getUserID(),
accountID.getService()
}).getText();
new ErrorDialog(null, msgText,
Messages.getI18NString("error").getText()).showDialog();
@ -268,8 +277,12 @@ else if (evt.getNewState().equals(RegistrationState.CONNECTION_FAILED)) {
this.mainFrame.getStatusPanel().updateStatus(evt.getProvider());
String msgText = Messages.getI18NString("connectionFailedMessage",
protocolProvider.getAccountID().getUserID()).getText();
String msgText = Messages.getI18NString(
"connectionFailedMessage",
new String[]{
accountID.getUserID(),
accountID.getService()
}).getText();
new ErrorDialog(null, msgText,
Messages.getI18NString("error").getText()).showDialog();
@ -280,8 +293,9 @@ else if (evt.getNewState().equals(RegistrationState.EXPIRED)) {
this.mainFrame.getStatusPanel().updateStatus(evt.getProvider());
String msgText = Messages.getI18NString("connectionExpiredMessage",
protocolProvider.getProtocolName()).getText();
String msgText = Messages.getI18NString(
"connectionExpiredMessage",
new String[]{protocolProvider.getProtocolName()}).getText();
new ErrorDialog(null, msgText,
Messages.getI18NString("error").getText()).showDialog();
@ -301,8 +315,12 @@ else if (evt.getNewState().equals(RegistrationState.UNREGISTERED)) {
if (!manuallyDisconnected) {
if (evt.getReasonCode() == RegistrationStateChangeEvent
.REASON_MULTIPLE_LOGINS) {
String msgText = Messages.getI18NString("multipleLogins",
protocolProvider.getAccountID().getUserID()).getText();
String msgText = Messages.getI18NString(
"multipleLogins",
new String[]{
accountID.getUserID(),
accountID.getService()
}).getText();
new ErrorDialog(null, msgText,
Messages.getI18NString("error").getText()).showDialog();
@ -310,8 +328,10 @@ else if (evt.getNewState().equals(RegistrationState.UNREGISTERED)) {
else if (evt.getReasonCode() == RegistrationStateChangeEvent
.REASON_CLIENT_LIMIT_REACHED_FOR_IP) {
String msgText = Messages.getI18NString("limitReachedForIp",
protocolProvider.getProtocolName()).getText();
String msgText = Messages.getI18NString(
"limitReachedForIp",
new String[]{protocolProvider.getProtocolName()})
.getText();
new ErrorDialog(null, msgText,
Messages.getI18NString("error").getText()).showDialog();
@ -321,8 +341,12 @@ else if (evt.getReasonCode() == RegistrationStateChangeEvent
//do nothing
}
else {
String msgText = Messages.getI18NString("unregisteredMessage",
protocolProvider.getAccountID().getUserID()).getText();
String msgText = Messages.getI18NString(
"unregisteredMessage",
new String[]{
accountID.getUserID(),
accountID.getService()
}).getText();
new ErrorDialog(null, msgText,
Messages.getI18NString("error").getText()).showDialog();
@ -480,8 +504,10 @@ else if (errorCode == OperationFailedException
new ErrorDialog(mainFrame,
Messages.getI18NString("loginNotSucceeded",
protocolProvider.getAccountID()
.getAccountAddress()).getText(),
new String[]{
protocolProvider.getAccountID().getUserID(),
protocolProvider.getAccountID().getService()
}).getText(),
Messages.getI18NString("error").getText()).showDialog();
mainFrame.getStatusPanel().updateStatus(protocolProvider);
@ -522,8 +548,10 @@ else if (errorCode == OperationFailedException.NETWORK_FAILURE) {
new ErrorDialog(mainFrame,
Messages.getI18NString("logoffNotSucceeded",
protocolProvider.getAccountID()
.getAccountAddress()).getText(),
new String[]{
protocolProvider.getAccountID().getUserID(),
protocolProvider.getAccountID().getService()
}).getText(),
Messages.getI18NString("error").getText()).showDialog();
}
}

@ -240,12 +240,14 @@ public void updateContactStatus(MetaContact metaContact, Contact protoContact)
metaContact.getDefaultContact().getPresenceStatus());
this.sendPanel.updateContactStatus(protoContact);
String message = this.conversationPanel.processMessage(
this.metaContact.getDisplayName(),
new Date(System.currentTimeMillis()),
Constants.SYSTEM_MESSAGE,
Messages.getI18NString("statusChangedChatMessage",
status.getStatusName()).getText());
new String[]{status.getStatusName()}).getText());
this.conversationPanel.appendMessageToEnd(message);
}

@ -106,7 +106,8 @@ public HistoryWindow(MainFrame mainFrame, MetaContact metaContact)
this.metaContact = metaContact;
this.setTitle(Messages.getI18NString(
"historyContact", metaContact.getDisplayName()).getText());
"historyContact",
new String[]{metaContact.getDisplayName()}).getText());
this.datesPanel = new DatesPanel(this);
this.historyMenu = new HistoryMenu(this);

@ -239,13 +239,19 @@ public void updateStatus(Object presenceStatus) {
}
catch (OperationFailedException e1) {
String accountName = protocolProvider.getAccountID().getUserID();
String accountUserID
= protocolProvider.getAccountID().getUserID();
String accountServerName
= protocolProvider.getAccountID().getService();
if (e1.getErrorCode()
== OperationFailedException.GENERAL_ERROR) {
String msgText
= Messages.getI18NString("statusChangeGeneralError",
accountName).getText();
= Messages.getI18NString("statusChangeGeneralError",
new String[]{
accountUserID,
accountServerName
}).getText();
new ErrorDialog(null, msgText, e1,
Messages.getI18NString("generalError").getText())
@ -257,7 +263,10 @@ else if (e1.getErrorCode()
String msgText
= Messages.getI18NString(
"statusChangeNetworkFailure",
accountName).getText();
new String[]{
accountUserID,
accountServerName
}).getText();
new ErrorDialog(
null,
@ -272,7 +281,10 @@ else if (e1.getErrorCode()
String msgText
= Messages.getI18NString(
"statusChangeNetworkFailure",
accountName).getText();
new String[]{
accountUserID,
accountServerName
}).getText();
new ErrorDialog(
null,

Loading…
Cancel
Save