From 41d514e37df3891157f9812729167f1b95833d6f Mon Sep 17 00:00:00 2001
From: Patrick Plitzner
Date: Tue, 21 Jun 2016 13:50:43 +0200
Subject: [PATCH 1/1] i18n for changing password #3102
---
.../OSGI-INF/l10n/bundle.properties | 14 ++++++--------
.../OSGI-INF/l10n/bundle_de.properties | 17 ++++++++++++-----
.../OSGI-INF/l10n/messages.properties | 14 ++++++++++++++
.../OSGI-INF/l10n/messages_de.properties | 14 ++++++++++++++
eu.etaxonomy.taxeditor.store/plugin.xml | 2 +-
.../java/eu/etaxonomy/taxeditor/Messages.java | 13 +++++++++++++
.../ui/password/EditPasswordElement.java | 5 +++--
.../taxeditor/ui/password/PasswordWizard.java | 13 ++++++++-----
.../ui/password/PasswordWizardPage.java | 19 +++++++++----------
9 files changed, 80 insertions(+), 31 deletions(-)
diff --git a/eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/bundle.properties b/eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/bundle.properties
index 7bd032ac4..6ed8a1328 100644
--- a/eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/bundle.properties
+++ b/eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/bundle.properties
@@ -60,7 +60,6 @@ command.name.1 = Create Datasource
command.name.3 = Update Datasource
command.name.4 = Show Login Window
command.name.5 = Open Defined Term Editor
-commandParameter.name = inputType
commandParameter.name.0 = inputType
command.name.6 = New Defined Term
command.name.7 = New Term Vocabulary
@@ -128,6 +127,10 @@ page.name.27 = Media
page.name.28 = Checklist Editor
page.name.29 = Editor Profile
page.name.30 = Language
+page.name.32 = Taxon Navigator
+page.name.33 = Sort of Taxonnodes
+page.name.34 = Debug Preferences
+page.name.35 = Areas for Distributions
command.label.clone = Clone
command.label.openInSpecimenEditor = Open in Specimen Editor
page.name.31 = Order of Taxonnodes
@@ -151,14 +154,8 @@ activity.description.2 = ROLE_USER_MANAGER dependent ui contributions
activity.name.2 = UserManagement
activity.description.3 = ROLE_PROJECT_MANAGER dependent ui contributions
activity.name.3 = ProjectManagement
-Bundle-Vendor = EDIT
-Bundle-Name = DataStore Bundle
command.name.13 = delete
command.name.14 = delete
-page.name.32 = Taxon Navigator
-page.name.33 = Sort of Taxonnodes
-page.name.34 = Debug Preferences
-page.name.35 = Areas for Distributions
command.name.15 = Open
view.name.SESSIONS = Sessions
command.label.SESSION = Sessions
@@ -171,4 +168,5 @@ command.name.OPEN_TAXONNODE_WIZARD = Open Taxon Node Wizard
command.name.INSPECT_ACTIVE_SESSIONS = Inspect Active Session
viewCommandMapping.viewerName.CLASSIFICATION_WIZARD = Classification Wizard
-viewCommandMapping.viewerName.TAXON_NODE_WIZARD = Taxon node Wizard
\ No newline at end of file
+viewCommandMapping.viewerName.TAXON_NODE_WIZARD = Taxon node Wizard
+command.label.CHANGE_PASSWORD = Change password
\ No newline at end of file
diff --git a/eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/bundle_de.properties b/eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/bundle_de.properties
index d54295aaa..a4a8084e8 100644
--- a/eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/bundle_de.properties
+++ b/eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/bundle_de.properties
@@ -60,7 +60,6 @@ command.name.1 = Erstelle Datenquelle
command.name.3 = Aktualisiere Datenquellen
command.name.4 = Zeige Login Window
command.name.5 = \u00d6ffne Editor f\u00fcr definierte Begriffe
-commandParameter.name = inputTyp
commandParameter.name.0 = inputTyp
command.name.6 = Neuer definierter Begriff
command.name.7 = Neues Begriffsvokabular
@@ -145,10 +144,18 @@ wizard.name.18 = CSV
wizard.name.19 = CSV_NAME
wizard.name.20 = CSV_PRINT
wizard.name.21 = Specimen Suche
+activity.description = DELETE abhängige UI-Erweiterungen
+activity.name = Löschen
+activity.description.0 = UPDATE abhängige UI-Erweiterungen
+activity.name.0 = Aktualisieren
+activity.description.1 = CREATE abhängige UI-Erweiterungen
+activity.name.1 = Löschen
+activity.description.2 = ROLE_USER_MANAGER abhängige UI-Erweiterungen
+activity.name.2 = User-Management
+activity.description.3 = ROLE_PROJECT_MANAGER abhängige UI-Erweiterungen
+activity.name.3 = Projekt-Management
command.name.13 = L\u00f6schen
command.name.14 = L\u00f6schen
-page.name.32 = Taxon Navigator
-page.name.33 = Reihenfolge der Taxon-Nodes
command.name.15 = \u00d6ffnen
view.name.SESSIONS = Sessions
command.label.SESSION = Sessions
@@ -159,7 +166,7 @@ command.name.RE_CONNECT = Aktualisiere Verbindung
command.name.OPEN_CLASSIFICATION_WIZARD = \u00d6ffne Klassifikations-Wizard
command.name.OPEN_TAXONNODE_WIZARD = \u00d6ffne Taxon Node-Wizard
-
command.name.INSPECT_ACTIVE_SESSIONS = Aktive Session untersuchen
viewCommandMapping.viewerName.CLASSIFICATION_WIZARD = Klassifikations-Wizard
-viewCommandMapping.viewerName.TAXON_NODE_WIZARD = Taxonknoten-Wizard
\ No newline at end of file
+viewCommandMapping.viewerName.TAXON_NODE_WIZARD = Taxnknoten-Wizard
+command.label.CHANGE_PASSWORD = Kennwort ändern
\ No newline at end of file
diff --git a/eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/messages.properties b/eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/messages.properties
index 7d26acc32..d324d4dc7 100644
--- a/eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/messages.properties
+++ b/eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/messages.properties
@@ -94,3 +94,17 @@ RemotingLoginDialog_GENERATING_CONFIG_FILE=Generating datasources config file fo
RemotingLoginDialog_JOB_SERVER_LAUNCH=Managed CDM Server Launch
RemotingLoginDialog_STARTING_MGD_SERVER=Starting Managed CDM Server. This may take a while.
RemotingLoginDialog_TASK_LAUNCHING_SERVER=Launching Managed CDM Server
+
+EditPasswordElement_PLEASE_CREATE_OR_SAVE_USER=Please create or save user '%s' before changing password
+EditPasswordElement_USERNAME_DOES_NOT_EXIST=Username does not exist
+PasswordWizard_COULD_NOT_CHANGE_PWD=Could not change password
+PasswordWizard_OLD_PWD_INCORRECT=The old password is not correct.
+PasswordWizard_PROBLEM_WITH_CHANGING_PWD=Problem with changing password
+PasswordWizard_PWD_COULD_NOT_BE_CHANGED=The password could not be changed.
+PasswordWizardPage_CHANGE_PASSWORD=Change password
+PasswordWizardPage_CHANGE_PASSWORD_AND_CONFIRM=Change password and confirm with current password
+PasswordWizardPage_NEW_PASSWORD=New Password
+PasswordWizardPage_OLD_PASSWORD=Old Password
+PasswordWizardPage_PASSWORD_MIN_CHARACTER=Password has to have at least %s characters
+PasswordWizardPage_PASSWORDS_DO_NOT_MATCH=The passwords do not match
+PasswordWizardPage_REPEAT_PASSWORD=Repeat Password
diff --git a/eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/messages_de.properties b/eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/messages_de.properties
index 16015fd62..1b0295b04 100644
--- a/eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/messages_de.properties
+++ b/eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/messages_de.properties
@@ -94,3 +94,17 @@ RemotingLoginDialog_GENERATING_CONFIG_FILE=Generiere Config-Datei f
RemotingLoginDialog_JOB_SERVER_LAUNCH=Starte internen CDM-Server
RemotingLoginDialog_STARTING_MGD_SERVER=Starte internen CDM-Server. Dies kann eine Weile dauern.
RemotingLoginDialog_TASK_LAUNCHING_SERVER=Starte internen CDM-Server
+
+EditPasswordElement_PLEASE_CREATE_OR_SAVE_USER=Bitte erstellen oder speichern sie den Nutzer '%s', bevor Sie das Kennwort ändern
+EditPasswordElement_USERNAME_DOES_NOT_EXIST=Nutzername existiert nicht
+PasswordWizard_COULD_NOT_CHANGE_PWD=Konnte das Kennwort nicht ändern
+PasswordWizard_OLD_PWD_INCORRECT=Das alte Kennwort ist inkorrekt
+PasswordWizard_PROBLEM_WITH_CHANGING_PWD=Fehler beim Ändern des Kennworts
+PasswordWizard_PWD_COULD_NOT_BE_CHANGED=Das Kennwort konnte nicht geändert werden
+PasswordWizardPage_CHANGE_PASSWORD=Kennwort ändern
+PasswordWizardPage_CHANGE_PASSWORD_AND_CONFIRM=Kennwort ändern und mit altem Kennwort bestätigen
+PasswordWizardPage_NEW_PASSWORD=Neues Kennwort
+PasswordWizardPage_OLD_PASSWORD=Altes Kennwort
+PasswordWizardPage_PASSWORD_MIN_CHARACTER=Kennwort muss mindesten %s Zeichen enthalten
+PasswordWizardPage_PASSWORDS_DO_NOT_MATCH=Die Kennwörter stimmen nicht überein
+PasswordWizardPage_REPEAT_PASSWORD=Kennwort wiederholen
diff --git a/eu.etaxonomy.taxeditor.store/plugin.xml b/eu.etaxonomy.taxeditor.store/plugin.xml
index babc87b9d..70bdd299b 100644
--- a/eu.etaxonomy.taxeditor.store/plugin.xml
+++ b/eu.etaxonomy.taxeditor.store/plugin.xml
@@ -431,7 +431,7 @@
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/Messages.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/Messages.java
index 31af5d0ba..e958729c7 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/Messages.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/Messages.java
@@ -71,6 +71,19 @@ public class Messages extends NLS {
public static String CdmStoreConnector_SCHEME_NOT_COMPATIBLE;
public static String CdmStoreConnector_UPDATE_DATASOUREC_OR_CHOOSE_NEW_DATASOURCE;
public static String CdmStoreConnector_UPDATE_EDITOR_OR_CHOOSE_COMPATIBLE_DATASOURCE;
+ public static String EditPasswordElement_PLEASE_CREATE_OR_SAVE_USER;
+ public static String EditPasswordElement_USERNAME_DOES_NOT_EXIST;
+ public static String PasswordWizard_COULD_NOT_CHANGE_PWD;
+ public static String PasswordWizard_OLD_PWD_INCORRECT;
+ public static String PasswordWizard_PROBLEM_WITH_CHANGING_PWD;
+ public static String PasswordWizard_PWD_COULD_NOT_BE_CHANGED;
+ public static String PasswordWizardPage_CHANGE_PASSWORD;
+ public static String PasswordWizardPage_CHANGE_PASSWORD_AND_CONFIRM;
+ public static String PasswordWizardPage_NEW_PASSWORD;
+ public static String PasswordWizardPage_OLD_PASSWORD;
+ public static String PasswordWizardPage_PASSWORD_MIN_CHARACTER;
+ public static String PasswordWizardPage_PASSWORDS_DO_NOT_MATCH;
+ public static String PasswordWizardPage_REPEAT_PASSWORD;
public static String RemotingLoginDialog_CHOOSE_COMPATIBLE_CDM_SERVER;
public static String RemotingLoginDialog_LABEL_ADVANCED;
public static String RemotingLoginDialog_LABEL_CDM_INSTANCE;
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/password/EditPasswordElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/password/EditPasswordElement.java
index e6010ddfc..9ac5d8c50 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/password/EditPasswordElement.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/password/EditPasswordElement.java
@@ -22,6 +22,7 @@ import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.api.service.IUserService;
import eu.etaxonomy.cdm.model.common.User;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.Messages;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmFormElement;
@@ -51,7 +52,7 @@ public class EditPasswordElement extends AbstractCdmFormElement implements Selec
Label label = formFactory.createLabel(getLayoutComposite(), null);
addControl(label);
- String buttonLabelString = (labelString != null) ? labelString : "Change Password";
+ String buttonLabelString = (labelString != null) ? labelString : Messages.PasswordWizardPage_CHANGE_PASSWORD;
button = formFactory.createButton(getLayoutComposite(), buttonLabelString, SWT.PUSH);
button.setLayoutData(LayoutConstants.RIGHT());
@@ -63,7 +64,7 @@ public class EditPasswordElement extends AbstractCdmFormElement implements Selec
@Override
public void widgetSelected(SelectionEvent e) {
if(!CdmStore.getService(IUserService.class).userExists(user.getUsername())) {
- MessagingUtils.warningDialog("Username does not exist", this, "Please create or save user '" + user.getUsername() + "' before changing password");
+ MessagingUtils.warningDialog(Messages.EditPasswordElement_USERNAME_DOES_NOT_EXIST, this, String.format(Messages.EditPasswordElement_PLEASE_CREATE_OR_SAVE_USER, user.getUsername()));
} else {
PasswordWizard wizard = new PasswordWizard(user, conversation);
WizardDialog dialog = new WizardDialog(getLayoutComposite().getShell(), wizard);
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/password/PasswordWizard.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/password/PasswordWizard.java
index 9b000fcb4..da6134bab 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/password/PasswordWizard.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/password/PasswordWizard.java
@@ -20,6 +20,7 @@ import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.api.service.IUserService;
import eu.etaxonomy.cdm.model.common.User;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.Messages;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
@@ -43,7 +44,7 @@ public class PasswordWizard extends Wizard implements IConversationEnabled{
public PasswordWizard(User user, ConversationHolder conversation){
this.conversation = conversation;
this.user = user;
- setWindowTitle("Change password");
+ setWindowTitle(Messages.PasswordWizardPage_CHANGE_PASSWORD);
}
@Override
@@ -60,7 +61,9 @@ public class PasswordWizard extends Wizard implements IConversationEnabled{
ConversationHolder internalConversation = CdmStore.getCurrentApplicationConfiguration().NewConversation();
internalConversation.bind();
internalConversation.startTransaction();
- try{
+ String warningTitle = Messages.PasswordWizard_COULD_NOT_CHANGE_PWD;
+ String warningMessage = Messages.PasswordWizard_OLD_PWD_INCORRECT;
+ try{
if(passwordPage.isChangingOwnPassword()){
// change own password with validating of old one
CdmStore.getService(IUserService.class).changePassword(passwordPage.getOldPassword(), passwordPage.getNewPassword());
@@ -74,14 +77,14 @@ public class PasswordWizard extends Wizard implements IConversationEnabled{
internalConversation.close();
return true;
}catch(AccessDeniedException e){
- MessagingUtils.warningDialog("Could not change password", this, "The old password is not correct.");
+ MessagingUtils.warningDialog(warningTitle, this, warningMessage);
return false;
}catch (AuthenticationException e){
- MessagingUtils.warningDialog("Could not change password", this, "The old password is not correct.");
+ MessagingUtils.warningDialog(warningTitle, this, warningMessage);
return false;
}catch(Exception e){
- MessagingUtils.warningDialog("Problem with changing password", this, "The password could not be changed. " + e.getMessage());
+ MessagingUtils.warningDialog(Messages.PasswordWizard_PROBLEM_WITH_CHANGING_PWD, this, Messages.PasswordWizard_PWD_COULD_NOT_BE_CHANGED + e.getMessage());
return false;
}finally{
if(conversation != null){
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/password/PasswordWizardPage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/password/PasswordWizardPage.java
index 4d1b75148..df8b005ac 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/password/PasswordWizardPage.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/password/PasswordWizardPage.java
@@ -20,6 +20,7 @@ import org.eclipse.swt.widgets.Text;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.taxeditor.Messages;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
@@ -35,8 +36,6 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
*/
public class PasswordWizardPage extends AbstractCdmEntityWizardPage implements ModifyListener{
- public static final String NAME = "USER_WIZARD_PAGE";
-
private TextWithLabelElement text_oldPassword;
private TextWithLabelElement text_password;
private TextWithLabelElement text_passwordRepeat;
@@ -48,8 +47,8 @@ public class PasswordWizardPage extends AbstractCdmEntityWizardPage implem
passwordValidator = new PasswordValidator();
- setTitle("Change password");
- setDescription("Change password and confirm with current password");
+ setTitle(Messages.PasswordWizardPage_CHANGE_PASSWORD);
+ setDescription(Messages.PasswordWizardPage_CHANGE_PASSWORD_AND_CONFIRM);
}
@Override
@@ -63,10 +62,10 @@ public class PasswordWizardPage extends AbstractCdmEntityWizardPage implem
WizardPageRootElement rootElement = new WizardPageRootElement(formFactory, control, getConversationHolder());
if(isChangingOwnPassword()) {
- text_oldPassword = formFactory.createTextWithLabelElement(rootElement, "Old Password", null, SWT.PASSWORD);
+ text_oldPassword = formFactory.createTextWithLabelElement(rootElement, Messages.PasswordWizardPage_OLD_PASSWORD, null, SWT.PASSWORD);
}
- text_password = formFactory.createTextWithLabelElement(rootElement, "New Password", null, SWT.PASSWORD);
- text_passwordRepeat = formFactory.createTextWithLabelElement(rootElement, "Repeat Password", null, SWT.PASSWORD);
+ text_password = formFactory.createTextWithLabelElement(rootElement, Messages.PasswordWizardPage_NEW_PASSWORD, null, SWT.PASSWORD);
+ text_passwordRepeat = formFactory.createTextWithLabelElement(rootElement, Messages.PasswordWizardPage_REPEAT_PASSWORD, null, SWT.PASSWORD);
((Text)text_passwordRepeat.getMainControl()).addModifyListener(this);
@@ -109,10 +108,10 @@ public class PasswordWizardPage extends AbstractCdmEntityWizardPage implem
private class PasswordValidator implements IInputValidator{
- private static final int PW_MIN_LENGTH = 5;
+ private final int PW_MIN_LENGTH = 5;
- private static final String TO_SHORT = "Password has to have at least " + PW_MIN_LENGTH + " characters";
- private static final String NO_MATCH = "The passwords do not match";
+ private final String TO_SHORT = String.format(Messages.PasswordWizardPage_PASSWORD_MIN_CHARACTER, PW_MIN_LENGTH);
+ private final String NO_MATCH = Messages.PasswordWizardPage_PASSWORDS_DO_NOT_MATCH;
@Override
public String isValid(String newText) {
--
2.34.1