Skip to content

Commit 2adef87

Browse files
committed
done with strings for keystore manager
1 parent 55ee776 commit 2adef87

File tree

2 files changed

+46
-97
lines changed

2 files changed

+46
-97
lines changed

mode/languages/mode.properties

Lines changed: 22 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -192,52 +192,33 @@ android_avd.error.cannot_load_avd_title = Could not load the AVD
192192
android_avd.error.cannot_load_avd_body = This could mean that the Android tools need to be updated,<br>or that the Processing AVD should be deleted (it will<br>automatically re-created the next time you run Processing).<br><br>You can use the avdmanager command line tool to create AVDs manually and list the current AVDs.
193193

194194

195-
static private final String AVD_TARGET_TITLE =
196-
"The SDK is not properly instaled";
197-
static private final String AVD_TARGET_MESSAGE =
198-
"Please re-read the installation instructions for Processing<br>" +
199-
"found in <a href=\"" + GETTING_START_TUT_URL + "\">this online tutorial</a>.";
195+
android_avd.error.sdk_wrong_install_title = The SDK is not properly instaled
196+
android_avd.error.sdk_wrong_install_body = Please re-read the installation instructions for Processing<br>found in <a href=\"%s\">this online tutorial</a>.
200197

201198

202199
# ---------------------------------------
203200
# Keystore manager
204201

205-
static final String KEYSTORE_LABEL_TEXT = "<html>" +
206-
"Please enter the information below so we can generate a private key for you.<br/>" +
207-
"Fields marked <b>bold</b> are required, " +
208-
"though you may consider to fill some of optional fields below those to avoid potential problems.<br/>" +
209-
"More about private keys can be found " +
210-
"<a href=\"" + GUIDE_URL + "\">here</a>.</body></html>";
211-
212-
static final String OK_BUTTON = "OK";
213-
static final String CANCEL_BUTTON = "Cancel";
214-
static final String RESET_BUTTON = "Reset password";
215-
216-
static final String RESET_KEYSTORE_TITLE = "Android keystore";
217-
static final String RESET_KEYSTORE_MESSAGE1 = "Are you sure you want to reset the password?";
218-
static final String RESET_KEYSTORE_MESSAGE2 = "We will have to reset the keystore to do this, which means \n" +
219-
"you won't be able to upload an update for your app signed with\n" +
220-
"the new keystore to Google Play.\n\n" +
221-
"We will make a backup for the old keystore.";
222-
223-
static final String FAILED_TO_REMOVE_TITLE = "Android keystore";
224-
static final String FAILED_TO_REMOVE_BODY = "Failed to remove keystore";
225-
226-
static final String PASSWORD_MISSMATCH_TITLE = "Passwords";
227-
static final String PASSWORD_MISSMATCH_BODY = "Keystore passwords do not match";
228-
229-
static final String PASSWORD_TOO_SHORT_TITLE = "Passwords";
230-
static final String PASSWORD_TOO_SHORT_BODY = "Keystore password should be at least 6 characters long";
231-
232-
static final String PASSWORD_LABEL = "Keystore password:";
233-
static final String REPEAT_PASSWROD_LABEL = "Repeat keystore password:";
234-
static final String ISSUER_CREDENTIALS = "Keystore issuer credentials";
235-
static final String COMMON_NAME_LABEL = "First and last name: ";
236-
static final String ORGANIZATIONAL_UNIT_LABEL = "Organizational unit: ";
237-
static final String ORGANIZATION_NAME_LABEL = "Organization name: ";
238-
static final String LOCALITY_NAME_LABEL = "City or locality: ";
239-
static final String STATE_NAME_LABEL = "State name: ";
240-
static final String COUNTRY_LABEL = "Country code (XX): ";
202+
keystore_manager.top_label = <html>Please enter the information below so we can generate a private key for you.<br/>Fields marked <b>bold</b> are required, though you may consider to fill some of optional fields below those to avoid potential problems.<br/>More about private keys can be found <a href=\"%s\">here</a>.</body></html>
203+
keystore_manager.reset_password = Reset password
204+
keystore_manager.dialog.reset_keyboard_title = Reset password
205+
keystore_manager.dialog.reset_keyboard_body_part1 = Are you sure you want to reset the password?
206+
keystore_manager.dialog.reset_keyboard_body_part2 = We will have to reset the keystore to do this, which means \nyou won't be able to upload an update for your app signed with\nthe new keystore to Google Play.\n\nWe will make a backup for the old keystore.
207+
keystore_manager.warn.cannot_remove_keystore_title = Android keystore
208+
keystore_manager.warn.cannot_remove_keystore_body = Failed to remove keystore
209+
keystore_manager.warn.password_missmatch_title = Passwords
210+
keystore_manager.warn.password_missmatch_body = Keystore passwords do not match
211+
keystore_manager.warn.short_password_title = Passwords
212+
keystore_manager.warn.short_password_body = Keystore password should be at least 6 characters long
213+
keystore_manager.password_label = Keystore password:
214+
keystore_manager.repeat_password_label = Repeat keystore password:
215+
keystore_manager.issuer_credentials_header = Keystore issuer credentials
216+
keystore_manager.common_name_label = First and last name:
217+
keystore_manager.organizational_unitl_label = Organizational unit:
218+
keystore_manager.organization_name_label = Organization name:
219+
keystore_manager.city_name_label = City or locality:
220+
keystore_manager.state_name_label = State name:
221+
keystore_manager.country_code_label = Country code (XX):
241222

242223
# ---------------------------------------
243224
# Manifest

mode/src/processing/mode/android/KeyStoreManager.java

Lines changed: 24 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
package processing.mode.android;
2323

24+
import processing.app.Language;
2425
import processing.app.Messages;
2526
import processing.app.Platform;
2627
import processing.app.ui.Toolkit;
@@ -49,43 +50,6 @@ public class KeyStoreManager extends JFrame {
4950

5051
static final String GUIDE_URL =
5152
"https://developer.android.com/studio/publish/app-signing.html";
52-
53-
static final String KEYSTORE_LABEL_TEXT = "<html>" +
54-
"Please enter the information below so we can generate a private key for you.<br/>" +
55-
"Fields marked <b>bold</b> are required, " +
56-
"though you may consider to fill some of optional fields below those to avoid potential problems.<br/>" +
57-
"More about private keys can be found " +
58-
"<a href=\"" + GUIDE_URL + "\">here</a>.</body></html>";
59-
60-
static final String OK_BUTTON = "OK";
61-
static final String CANCEL_BUTTON = "Cancel";
62-
static final String RESET_BUTTON = "Reset password";
63-
64-
static final String RESET_KEYSTORE_TITLE = "Android keystore";
65-
static final String RESET_KEYSTORE_MESSAGE1 = "Are you sure you want to reset the password?";
66-
static final String RESET_KEYSTORE_MESSAGE2 = "We will have to reset the keystore to do this, which means \n" +
67-
"you won't be able to upload an update for your app signed with\n" +
68-
"the new keystore to Google Play.\n\n" +
69-
"We will make a backup for the old keystore.";
70-
71-
static final String FAILED_TO_REMOVE_TITLE = "Android keystore";
72-
static final String FAILED_TO_REMOVE_BODY = "Failed to remove keystore";
73-
74-
static final String PASSWORD_MISSMATCH_TITLE = "Passwords";
75-
static final String PASSWORD_MISSMATCH_BODY = "Keystore passwords do not match";
76-
77-
static final String PASSWORD_TOO_SHORT_TITLE = "Passwords";
78-
static final String PASSWORD_TOO_SHORT_BODY = "Keystore password should be at least 6 characters long";
79-
80-
static final String PASSWORD_LABEL = "Keystore password:";
81-
static final String REPEAT_PASSWROD_LABEL = "Repeat keystore password:";
82-
static final String ISSUER_CREDENTIALS = "Keystore issuer credentials";
83-
static final String COMMON_NAME_LABEL = "First and last name: ";
84-
static final String ORGANIZATIONAL_UNIT_LABEL = "Organizational unit: ";
85-
static final String ORGANIZATION_NAME_LABEL = "Organization name: ";
86-
static final String LOCALITY_NAME_LABEL = "City or locality: ";
87-
static final String STATE_NAME_LABEL = "State name: ";
88-
static final String COUNTRY_LABEL = "Country code (XX): ";
8953

9054
File keyStore;
9155
AndroidEditor editor;
@@ -127,7 +91,7 @@ private void createLayout() {
12791
// buttons
12892
JPanel buttons = new JPanel();
12993
buttons.setAlignmentX(LEFT_ALIGNMENT);
130-
JButton okButton = new JButton(OK_BUTTON);
94+
JButton okButton = new JButton(Language.text("prompt.ok"));
13195
Dimension dim = new Dimension(Toolkit.getButtonWidth(),
13296
okButton.getPreferredSize().height);
13397
okButton.setPreferredSize(dim);
@@ -154,7 +118,7 @@ public void actionPerformed(ActionEvent e) {
154118
});
155119
okButton.setEnabled(true);
156120

157-
JButton cancelButton = new JButton(CANCEL_BUTTON);
121+
JButton cancelButton = new JButton(Language.text("prompt.cancel"));
158122
cancelButton.setPreferredSize(dim);
159123
cancelButton.addActionListener(new ActionListener() {
160124
public void actionPerformed(ActionEvent e) {
@@ -163,21 +127,23 @@ public void actionPerformed(ActionEvent e) {
163127
});
164128
cancelButton.setEnabled(true);
165129

166-
JButton resetKeystoreButton = new JButton(RESET_BUTTON);
130+
JButton resetKeystoreButton = new JButton(AndroidMode.getTextString("keystore_manager.reset_password"));
167131
dim = new Dimension(Toolkit.getButtonWidth()*2,
168132
resetKeystoreButton.getPreferredSize().height);
169133
resetKeystoreButton.setPreferredSize(dim);
170134
resetKeystoreButton.addActionListener(new ActionListener() {
171135
public void actionPerformed(ActionEvent e) {
172136
setVisible(false);
173-
int result = Messages.showYesNoQuestion(editor, RESET_KEYSTORE_TITLE,
174-
RESET_KEYSTORE_MESSAGE1, RESET_KEYSTORE_MESSAGE2);
137+
int result = Messages.showYesNoQuestion(editor, AndroidMode.getTextString("keystore_manager.dialog.reset_keyboard_title"),
138+
AndroidMode.getTextString("keystore_manager.dialog.reset_keyboard_body_part1"),
139+
AndroidMode.getTextString("keystore_manager.dialog.reset_keyboard_body_part2"));
175140

176141
if (result == JOptionPane.NO_OPTION) {
177142
setVisible(true);
178143
} else {
179144
if (!AndroidKeyStore.resetKeyStore()) {
180-
Messages.showWarning(FAILED_TO_REMOVE_TITLE, FAILED_TO_REMOVE_BODY);
145+
Messages.showWarning(AndroidMode.getTextString("keystore_manager.warn.cannot_remove_keystore_title"),
146+
AndroidMode.getTextString("keystore_manager.warn.cannot_remove_keystore_body"));
181147
setVisible(true);
182148
} else {
183149
keyStore = null;
@@ -228,7 +194,7 @@ public void actionPerformed(ActionEvent actionEvent) {
228194

229195
private void showKeystorePasswordLayout(Box pain) {
230196
passwordField = new JPasswordField(15);
231-
JLabel passwordLabel = new JLabel("<html><body><b>" + PASSWORD_LABEL + " </b></body></html>");
197+
JLabel passwordLabel = new JLabel("<html><body><b>" + AndroidMode.getTextString("keystore_manager.password_label") + " </b></body></html>");
232198
passwordLabel.setLabelFor(passwordField);
233199

234200
JPanel textPane = new JPanel(new FlowLayout(FlowLayout.TRAILING));
@@ -245,17 +211,19 @@ private boolean checkRequiredFields() {
245211
if (Arrays.equals(passwordField.getPassword(), repeatPasswordField.getPassword())) {
246212
return true;
247213
} else {
248-
Messages.showWarning(PASSWORD_MISSMATCH_TITLE, PASSWORD_MISSMATCH_BODY);
214+
Messages.showWarning(AndroidMode.getTextString("keystore_manager.warn.password_missmatch_title"),
215+
AndroidMode.getTextString("keystore_manager.warn.password_missmatch_body"));
249216
return false;
250217
}
251218
} else {
252-
Messages.showWarning(PASSWORD_TOO_SHORT_TITLE, PASSWORD_TOO_SHORT_BODY);
219+
Messages.showWarning(AndroidMode.getTextString("keystore_manager.warn.short_password_title"),
220+
AndroidMode.getTextString("keystore_manager.warn.short_password_body"));
253221
return false;
254222
}
255223
}
256224

257225
private void showKeystoreCredentialsLayout(Box box) {
258-
String labelText = KEYSTORE_LABEL_TEXT;
226+
String labelText = AndroidMode.getTextString("keystore_manager.top_label");
259227
JLabel textarea = new JLabel(labelText);
260228
textarea.setPreferredSize(new Dimension(LABEL_WIDTH, LABEL_HEIGHT));
261229
textarea.addMouseListener(new MouseAdapter() {
@@ -268,7 +236,7 @@ public void mouseClicked(MouseEvent e) {
268236

269237
// password field
270238
passwordField = new JPasswordField(15);
271-
JLabel passwordLabel = new JLabel("<html><body><b>" + PASSWORD_LABEL + " </b></body></html>");
239+
JLabel passwordLabel = new JLabel("<html><body><b>" + AndroidMode.getTextString("keystore_manager.password_label") + " </b></body></html>");
272240
passwordLabel.setLabelFor(passwordField);
273241

274242
JPanel textPane = new JPanel(new FlowLayout(FlowLayout.TRAILING));
@@ -279,7 +247,7 @@ public void mouseClicked(MouseEvent e) {
279247

280248
// repeat password field
281249
repeatPasswordField = new JPasswordField(15);
282-
JLabel repeatPasswordLabel = new JLabel("<html><body><b>" + REPEAT_PASSWROD_LABEL + " </b></body></html>");
250+
JLabel repeatPasswordLabel = new JLabel("<html><body><b>" + AndroidMode.getTextString("keystore_manager.repeat_password_label") + " </b></body></html>");
283251
repeatPasswordLabel.setLabelFor(passwordField);
284252

285253
textPane = new JPanel(new FlowLayout(FlowLayout.TRAILING));
@@ -290,14 +258,14 @@ public void mouseClicked(MouseEvent e) {
290258
box.add(textPane);
291259

292260
MatteBorder mb = new MatteBorder(1, 0, 0, 0, Color.LIGHT_GRAY);
293-
TitledBorder tb = new TitledBorder(mb, ISSUER_CREDENTIALS, TitledBorder.LEFT, TitledBorder.DEFAULT_POSITION);
261+
TitledBorder tb = new TitledBorder(mb, AndroidMode.getTextString("keystore_manager.issuer_credentials_header"), TitledBorder.LEFT, TitledBorder.DEFAULT_POSITION);
294262
JPanel separatorPanel = new JPanel();
295263
separatorPanel.setBorder(tb);
296264
box.add(separatorPanel);
297265

298266
// common name (CN)
299267
commonName = new JTextField(15);
300-
JLabel commonNameLabel = new JLabel(COMMON_NAME_LABEL);
268+
JLabel commonNameLabel = new JLabel(AndroidMode.getTextString("keystore_manager.common_name_label"));
301269
commonNameLabel.setLabelFor(commonName);
302270

303271
textPane = new JPanel(new FlowLayout(FlowLayout.TRAILING));
@@ -308,7 +276,7 @@ public void mouseClicked(MouseEvent e) {
308276

309277
// organizational unit (OU)
310278
organizationalUnit = new JTextField(15);
311-
JLabel organizationalUnitLabel = new JLabel(ORGANIZATIONAL_UNIT_LABEL);
279+
JLabel organizationalUnitLabel = new JLabel(AndroidMode.getTextString("keystore_manager.organizational_unitl_label"));
312280
organizationalUnitLabel.setLabelFor(organizationalUnit);
313281

314282
textPane = new JPanel(new FlowLayout(FlowLayout.TRAILING));
@@ -319,7 +287,7 @@ public void mouseClicked(MouseEvent e) {
319287

320288
// organization name (O)
321289
organizationName = new JTextField(15);
322-
JLabel organizationNameLabel = new JLabel(ORGANIZATION_NAME_LABEL);
290+
JLabel organizationNameLabel = new JLabel(AndroidMode.getTextString("keystore_manager.organization_name_label"));
323291
organizationNameLabel.setLabelFor(organizationName);
324292

325293
textPane = new JPanel(new FlowLayout(FlowLayout.TRAILING));
@@ -330,7 +298,7 @@ public void mouseClicked(MouseEvent e) {
330298

331299
// locality name (L)
332300
localityName = new JTextField(15);
333-
JLabel localityNameLabel = new JLabel(LOCALITY_NAME_LABEL);
301+
JLabel localityNameLabel = new JLabel(AndroidMode.getTextString("keystore_manager.city_name_label"));
334302
localityNameLabel.setLabelFor(localityName);
335303

336304
textPane = new JPanel(new FlowLayout(FlowLayout.TRAILING));
@@ -341,7 +309,7 @@ public void mouseClicked(MouseEvent e) {
341309

342310
// state name (S)
343311
stateName = new JTextField(15);
344-
JLabel stateNameLabel = new JLabel(STATE_NAME_LABEL);
312+
JLabel stateNameLabel = new JLabel(AndroidMode.getTextString("keystore_manager.state_name_label"));
345313
stateNameLabel.setLabelFor(stateName);
346314

347315
textPane = new JPanel(new FlowLayout(FlowLayout.TRAILING));
@@ -352,7 +320,7 @@ public void mouseClicked(MouseEvent e) {
352320

353321
// country (C)
354322
country = new JTextField(15);
355-
JLabel countryLabel = new JLabel(COUNTRY_LABEL);
323+
JLabel countryLabel = new JLabel(AndroidMode.getTextString("keystore_manager.country_code_label"));
356324
countryLabel.setLabelFor(country);
357325

358326
textPane = new JPanel(new FlowLayout(FlowLayout.TRAILING));

0 commit comments

Comments
 (0)