Skip to content

Commit 81571ea

Browse files
committed
Implement localization in more places (07022022)
Another part of #1
1 parent 47d9ee1 commit 81571ea

11 files changed

+60
-32
lines changed

res/text/common_en.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Back
2+
Beatmapset select
3+
Pallete editor
4+
Check
5+
keybinds setup
6+
pause/exit
7+
column
8+
press a key for the
9+
Cancel
10+
There are no keybinds for this mode
11+
Set them.
12+
RESULTS
13+
any key to proceed
14+
Edit
15+
Total score
16+
Max combo
17+
Accuracy
18+
Full combo
19+
Save & exit
20+
Choose skin type
21+
Settings
22+
Audio
23+
System
24+
not set
25+
Continue
26+
Retry
27+
Quit

src/nmania/Nmania.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@ public final class Nmania extends MIDlet {
1717

1818
public static Nmania inst;
1919
public boolean running;
20+
public static BeatmapManager bm;
21+
public static Skin skin;
22+
public static String[] commonText;
2023

2124
public Nmania() {
25+
inst = this;
2226
}
2327

2428
protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
@@ -27,19 +31,17 @@ protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
2731
protected void pauseApp() {
2832
}
2933

30-
public static BeatmapManager bm;
31-
public static Skin skin;
3234

3335
public static void LoadManager(String dir) throws IOException {
3436
bm = new BeatmapManager(dir);
3537
bm.Init();
3638
}
3739

3840
protected void startApp() throws MIDletStateChangeException {
39-
inst = this;
4041
if (running)
4142
return;
4243
Settings.Load();
44+
commonText = getStrings("common");
4345
Push(new MainScreen());
4446
}
4547

src/nmania/Player.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,6 @@ private void PassSequence() {
654654
* Loop method, that handles pause menu redrawing.
655655
*/
656656
private void PauseUpdateLoop() {
657-
String[] pauseText = new String[] { "Continue", "Retry", "Quit" };
658657
while (isPaused) {
659658
int sw3 = scrW / 3;
660659
int sh5 = scrH / 5;
@@ -665,7 +664,7 @@ private void PauseUpdateLoop() {
665664
g.setColor((i == pauseItem ? 255 : 0), 0, 0);
666665
g.drawRect(sw3, ry, sw3 - 1, sh5 - 1);
667666
g.setColor(-1);
668-
g.drawString(pauseText[i], scrW / 2, ry + sh5 / 2 - fillCountersH / 2, 17); // hcenter+top
667+
g.drawString(Nmania.commonText[24 + i], scrW / 2, ry + sh5 / 2 - fillCountersH / 2, 17); // hcenter+top
669668
}
670669
flushGraphics();
671670
try {
@@ -734,7 +733,7 @@ private void FailSequence(boolean exitAfter) {
734733
g.setColor((i == pauseItem ? 255 : 0), 0, 0);
735734
g.drawRect(sw3, ry, sw3 - 1, sh5 - 1);
736735
g.setColor(-1);
737-
g.drawString(i == 0 ? "Retry" : "Quit", scrW / 2, ry + sh5 / 2 - fillCountersH / 2, 17); // hcenter+top
736+
g.drawString(Nmania.commonText[25 + i], scrW / 2, ry + sh5 / 2 - fillCountersH / 2, 17); // hcenter+top
738737
}
739738
flushGraphics();
740739
try {

src/nmania/PlayerLoader.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public PlayerLoader(BeatmapSet set, String bmFileName, boolean auto, BeatmapSetP
2929
Displayable page;
3030
final boolean auto;
3131
Alert a;
32-
Command cancelCmd = new Command("Cancel", Command.STOP, 1);
32+
Command cancelCmd = new Command(Nmania.commonText[8], Command.STOP, 1);
3333

3434
public void run() {
3535
a = new Alert("nmania", "Reading beatmap file", null, AlertType.INFO);
@@ -64,7 +64,7 @@ public void run() {
6464
// no keyboard layout
6565
KeyboardSetup kbs = new KeyboardSetup(b.columnsCount, page);
6666
PushWaitPush(kbs,
67-
new Alert("nmania", "There are no keybinds for this mode (" + b.columnsCount + "K). Set them.",
67+
new Alert("nmania", Nmania.commonText[9] + " (" + b.columnsCount + "K). " + Nmania.commonText[10],
6868
null, AlertType.WARNING));
6969
return;
7070
}

src/nmania/ui/BeatmapSetsList.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
public class BeatmapSetsList extends List implements CommandListener {
1616

1717
private BeatmapManager bm;
18-
private Command back = new Command("Back", Command.BACK, 1);
18+
private Command back = new Command(Nmania.commonText[0], Command.BACK, 1);
1919

2020
public BeatmapSetsList(BeatmapManager bm) throws IOException {
21-
super("Beatmapset select", Choice.IMPLICIT);
21+
super(Nmania.commonText[1], Choice.IMPLICIT);
2222
setCommandListener(this);
2323
this.bm = bm;
2424
Enumeration e = bm.list();

src/nmania/ui/ColorPalleteEditor.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
public class ColorPalleteEditor extends Form implements CommandListener {
1717

1818
public ColorPalleteEditor(int[] colors, Displayable prev) {
19-
super("Pallete editor");
19+
super(Nmania.commonText[2]);
2020
this.prev = prev;
2121
this.colors = colors;
2222
fields = new TextField[colors.length];
@@ -32,8 +32,8 @@ public ColorPalleteEditor(int[] colors, Displayable prev) {
3232
addCommand(view);
3333
}
3434

35-
private final Command back = new Command("Back", Command.BACK, 1);
36-
private final Command view = new Command("Check", Command.SCREEN, 2);
35+
private final Command back = new Command(Nmania.commonText[0], Command.BACK, 1);
36+
private final Command view = new Command(Nmania.commonText[3], Command.SCREEN, 2);
3737
final Displayable prev;
3838
public final int[] colors;
3939
TextField[] fields;
@@ -50,7 +50,7 @@ public void commandAction(Command c, Displayable arg1) {
5050
Nmania.Push(new ColorPalletePreview(this));
5151
} catch (Exception e) {
5252
e.printStackTrace();
53-
Nmania.Push(new Alert("Pallete editor", "Color " + (i + 1) + " is invalid. Check the field.", null,
53+
Nmania.Push(new Alert(Nmania.commonText[2], "Color " + (i + 1) + " is invalid. Check the field.", null,
5454
AlertType.ERROR));
5555
}
5656

src/nmania/ui/KeyboardSetup.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ protected final void paint(Graphics g) {
4848
// top text
4949
g.setColor(-1);
5050
g.setFont(large);
51-
g.drawString("keybinds setup (" + columns + "K)", w / 2, 0, 17);
51+
g.drawString(Nmania.commonText[4] + " (" + columns + "K)", w / 2, 0, 17);
5252
String keyCapt;
5353
switch (currentColumn) {
5454
case 0:
@@ -65,12 +65,12 @@ protected final void paint(Graphics g) {
6565
break;
6666
}
6767
if (currentColumn == columns) {
68-
keyCapt = "pause/exit";
68+
keyCapt = Nmania.commonText[5];
6969
} else {
70-
keyCapt = keyCapt + " column";
70+
keyCapt = keyCapt + " " + Nmania.commonText[6];
7171
}
7272
g.setFont(small);
73-
g.drawString("press a key for the " + keyCapt, w / 2, large.getHeight(), 17);
73+
g.drawString(Nmania.commonText[7] + " " + keyCapt, w / 2, large.getHeight(), 17);
7474

7575
// cols
7676
int colW = w / columns;
@@ -101,7 +101,7 @@ protected final void paint(Graphics g) {
101101
g.fillRect(i * colW + 1, h - sfh * 3 + 1, colW - 1, sfh * 3 - 1);
102102
}
103103
}
104-
if(currentColumn == columns) {
104+
if (currentColumn == columns) {
105105
g.setColor(255, 255, 0);
106106
g.fillRect(0, h - sfh * 4, w, sfh);
107107
}

src/nmania/ui/ResultsScreen.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,17 @@ protected void paint(Graphics g) {
5757

5858
g.setColor(-1);
5959
g.setFont(Font.getFont(0, 0, 16));
60-
g.drawString("RESULTS", w / 2, -introTimer, 17);
60+
g.drawString(Nmania.commonText[11], w / 2, -introTimer, 17);
6161
g.setFont(Font.getFont(0, 0, 8));
62-
g.drawString("any key to proceed", w / 2, h + introTimer, Graphics.BOTTOM | Graphics.HCENTER);
62+
g.drawString(Nmania.commonText[12], w / 2, h + introTimer, Graphics.BOTTOM | Graphics.HCENTER);
6363

6464
int th = Font.getFont(0, 0, 8).getHeight();
6565
int y = (h - th * 9) / 2;
66-
drawRow(g, 0, "Total score", -1, String.valueOf(score.currentHitScore), y, w);
66+
drawRow(g, 0, Nmania.commonText[14], -1, String.valueOf(score.currentHitScore), y, w);
6767
y += th;
68-
drawRow(g, 1, "Max combo", -1, score.hits[0] == 0 ? "Full combo" : String.valueOf(score.maxCombo), y, w);
68+
drawRow(g, 1, Nmania.commonText[15], -1, score.hits[0] == 0 ? Nmania.commonText[17] : String.valueOf(score.maxCombo), y, w);
6969
y += th;
70-
drawRow(g, 2, "Accuracy", -1, String.valueOf((score.GetAccuracy() / 100f) + "%"), y, w);
70+
drawRow(g, 2, Nmania.commonText[16], -1, String.valueOf((score.GetAccuracy() / 100f) + "%"), y, w);
7171
y += th;
7272
for (int i = 0; i < 6; i++) {
7373
drawRow(g, 3 + i, Player.judgements[i], Player.judgementColors[i], String.valueOf(score.hits[i]), y, w);

src/nmania/ui/SettingsScreen.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ public String[] GetItems() {
226226
}
227227

228228
public String GetTitle() {
229-
return "nmania settings";
229+
return Nmania.commonText[20];
230230
}
231231

232232
public void paint(Graphics g, int y, int sw) {
@@ -261,7 +261,7 @@ public void OnSelect(int i) {
261261
}
262262

263263
public String GetTitle() {
264-
return "Audio";
264+
return Nmania.commonText[21];
265265
}
266266

267267
final String[] items = Nmania.getStrings("sets_audio");
@@ -301,7 +301,7 @@ public void OnSelect(int i) {
301301
}
302302

303303
public String GetTitle() {
304-
return "System";
304+
return Nmania.commonText[22];
305305
}
306306

307307
final String[] items = Nmania.getStrings("sets_system");
@@ -340,7 +340,7 @@ public String[] GetItems() {
340340
public void paint(Graphics g, int y, int sw) {
341341
for (int i = 0; i < 10; i++) {
342342
if (i > 0 && Settings.keyLayout[i] == null) {
343-
g.drawString("not set", getWidth() - 10, y + th * i, 24);
343+
g.drawString(Nmania.commonText[23], getWidth() - 10, y + th * i, 24);
344344
}
345345
}
346346
}

src/nmania/ui/SkinSelect.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ protected void paint(Graphics g) {
4848
g.fillRect(0, 0, w, h);
4949
g.setColor(-1);
5050

51-
g.drawString("Choose skin type", w / 2, -outroTimer, 17);
51+
g.drawString(Nmania.commonText[19], w / 2, -outroTimer, 17);
5252
int x1 = w / 4;
5353
int x2 = w * 3 / 4;
5454
if (outroTimer != 0) {
@@ -80,7 +80,7 @@ protected void paint(Graphics g) {
8080
if (!selectionFocused && outroTimer == 0)
8181
g.fillRect(5, h - th - 5, w - 10, th);
8282
g.setColor(-1);
83-
g.drawString("Save & exit", w / 2, h - 5 + outroTimer, 33);
83+
g.drawString(Nmania.commonText[18], w / 2, h - 5 + outroTimer, 33);
8484

8585
if (introTimer > 0) {
8686
g.setColor(-1);

0 commit comments

Comments
 (0)