Skip to content

Commit 1961d67

Browse files
committed
done with strings for manifest and permissions
1 parent 2adef87 commit 1961d67

File tree

3 files changed

+13
-28
lines changed

3 files changed

+13
-28
lines changed

mode/languages/mode.properties

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -223,23 +223,14 @@ keystore_manager.country_code_label = Country code (XX):
223223
# ---------------------------------------
224224
# Manifest
225225

226-
MANIFEST_ERROR_TITLE ="Error handling " + MANIFEST_XML;
227-
static final String MANIFEST_ERROR_MESSAGE =
228-
"Errors occurred while reading or writing " + MANIFEST_XML + ",\n" +
229-
"which means lots of things are likely to stop working properly.\n" +
230-
"To prevent losing any data, it's recommended that you use “Save As”\n" +
231-
"to save a separate copy of your sketch, and then restart Processing.";
226+
manifest.warn.cannot_handle_file_title = Error handling %s
227+
manifest.warn.cannot_handle_file_body = Errors occurred while reading or writing %s\nwhich means lots of things are likely to stop working properly.\nTo prevent losing any data, it's recommended that you use “Save As”\n"to save a separate copy of your sketch, and then restart Processing.";
232228

233229
# ---------------------------------------
234230
# Permissions
235231

236-
PERMISSIONS_LABEL_TEXT ="<html>" +
237-
"Android applications must specifically ask for permission\n" +
238-
"to do things like connect to the internet, write a file,\n" +
239-
"or make phone calls. When installing your application,\n" +
240-
"users will be asked whether they want to allow such access.</html>";
241-
PERMISSIONS_URL_TEXT = "<html>More about permissions can be found " +
242-
"<a href=\"" + GUIDE_URL + "\">here</a>.</html>";
232+
permissions.dialog.label = <html>Android applications must specifically ask for permission\nto do things like connect to the internet, write a file,\nor make phone calls. When installing your application,\nusers will be asked whether they want to allow such access.</html>
233+
permissions.dialog.url = "<html>More about permissions can be found <a href=\"%s\">here</a>.</html>
243234

244235
# ---------------------------------------
245236
# SDK Downloader

mode/src/processing/mode/android/Manifest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
public class Manifest {
4545
static final String MANIFEST_XML = "AndroidManifest.xml";
4646

47-
static final String MANIFEST_ERROR_TITLE ="Error handling " + MANIFEST_XML;
47+
static final String MANIFEST_ERROR_TITLE = "Error handling " + MANIFEST_XML;
4848
static final String MANIFEST_ERROR_MESSAGE =
4949
"Errors occurred while reading or writing " + MANIFEST_XML + ",\n" +
5050
"which means lots of things are likely to stop working properly.\n" +
@@ -407,7 +407,8 @@ protected void load(boolean forceNew) {
407407
}
408408
}
409409
if (xml == null) {
410-
Messages.showWarning(MANIFEST_ERROR_TITLE, MANIFEST_ERROR_MESSAGE);
410+
Messages.showWarning(AndroidMode.getTextString("manifest.warn.cannot_handle_file_title", MANIFEST_XML),
411+
AndroidMode.getTextString("manifest.warn.cannot_handle_file_body", MANIFEST_XML));
411412
}
412413
}
413414

mode/src/processing/mode/android/Permissions.java

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import javax.swing.border.*;
3535
import javax.swing.event.*;
3636

37+
import processing.app.Language;
3738
import processing.app.Platform;
3839
import processing.app.Sketch;
3940
import processing.app.ui.Toolkit;
@@ -43,15 +44,7 @@
4344
public class Permissions extends JFrame {
4445
static final String GUIDE_URL =
4546
"https://developer.android.com/training/articles/security-tips.html#Permissions";
46-
47-
private static final String PERMISSIONS_LABEL_TEXT ="<html>" +
48-
"Android applications must specifically ask for permission\n" +
49-
"to do things like connect to the internet, write a file,\n" +
50-
"or make phone calls. When installing your application,\n" +
51-
"users will be asked whether they want to allow such access.</html>";
52-
private static final String PERMISSIONS_URL_TEXT = "<html>More about permissions can be found " +
53-
"<a href=\"" + GUIDE_URL + "\">here</a>.</html>";
54-
47+
5548
static final int BORDER_HORIZ = Toolkit.zoom(5);
5649
static final int BORDER_VERT = Toolkit.zoom(3);
5750
static final int CELL_HEIGHT = Toolkit.zoom(20);
@@ -125,8 +118,8 @@ public void keyTyped(KeyEvent e) {
125118
vbox.setBorder(new EmptyBorder(BORDER, BORDER, BORDER, BORDER));
126119
outer.add(vbox);
127120

128-
String labelText = PERMISSIONS_LABEL_TEXT;
129-
String urlText = PERMISSIONS_URL_TEXT;
121+
String labelText = AndroidMode.getTextString("permissions.dialog.label");
122+
String urlText = AndroidMode.getTextString("permissions.dialog.url", GUIDE_URL);
130123
JLabel textarea = new JLabel(labelText);
131124
JLabel urlarea = new JLabel(urlText);
132125
textarea.setPreferredSize(new Dimension(TEXT_WIDTH, TEXT_HEIGHT));
@@ -155,7 +148,7 @@ public void mouseClicked(MouseEvent e) {
155148

156149
JPanel buttons = new JPanel();
157150
buttons.setAlignmentX(LEFT_ALIGNMENT);
158-
JButton okButton = new JButton("OK");
151+
JButton okButton = new JButton(Language.text("prompt.ok"));
159152
Dimension dim = new Dimension(Toolkit.getButtonWidth(),
160153
okButton.getPreferredSize().height);
161154
okButton.setPreferredSize(dim);
@@ -167,7 +160,7 @@ public void actionPerformed(ActionEvent e) {
167160
});
168161
okButton.setEnabled(true);
169162

170-
JButton cancelButton = new JButton("Cancel");
163+
JButton cancelButton = new JButton(Language.text("prompt.cancel"));
171164
cancelButton.setPreferredSize(dim);
172165
cancelButton.addActionListener(new ActionListener() {
173166
public void actionPerformed(ActionEvent e) {

0 commit comments

Comments
 (0)