Skip to content

Commit

Permalink
Add further Terminal translation (#904)
Browse files Browse the repository at this point in the history
* Translated Wallpaper path type

* fix buttons are not working

* Add localization for non-selector part of the button

* Localized maze app

* localize minesweeper app

* localize cape selector app

* Remove I18n
  • Loading branch information
Quarri6343 authored May 8, 2022
1 parent 54cd764 commit bd88d5a
Show file tree
Hide file tree
Showing 8 changed files with 143 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ public AbstractApplication initApp() {

this.addWidget(new SimpleTextWidget(166, 33, "", 0xFFFFFF, () -> {
if(this.getCapeList().getCapes() == null || this.getCapeList().getCapes().isEmpty()) {
return "It looks like you haven't unlocked any capes yet!";
return "terminal.cape_selector.empty";
}
return "Click on an unlocked cape to select it!";
return "terminal.cape_selector.select";
}));

this.addWidget(new SimpleTextWidget(166, 45, "", 0xFFFFFF, () -> {
if(this.getCapeList().getCapes() == null || this.getCapeList().getCapes().isEmpty()) {
return "You can get these from high-level advancements.";
return "terminal.cape_selector.tip";
}
return "";
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public AbstractApplication initApp() {
this.setOs(os);
this.addWidget(new ImageWidget(5, 5, 333 - 10, 232 - 10, TerminalTheme.COLOR_B_2));
// enemy 0: Title
this.addWidget(new LabelWidget(333 / 2, 222 / 2 - 50, "Theseus's Escape", 0xFFFFFFFF).setXCentered(true), 0);
this.addWidget(new ClickButtonWidget(323 / 2 - 10, 222 / 2 - 10, 30, 30, "Play",
this.addWidget(new LabelWidget(333 / 2, 222 / 2 - 50, "terminal.maze.title", 0xFFFFFFFF).setXCentered(true), 0);
this.addWidget(new ClickButtonWidget(323 / 2 - 10, 222 / 2 - 10, 30, 30, "terminal.maze.play",
(clickData -> {
this.setGameState(1);
this.resetGame();
Expand All @@ -60,13 +60,13 @@ public AbstractApplication initApp() {
this.setEnemy(new EnemyWidget(-100, -100, this));
// GameState 2: Pause
this.addWidget(new ImageWidget(5, 5, 333 - 10, 232 - 10, new ColorRectTexture(0xFF000000)), 2, 3);
this.addWidget(new ClickButtonWidget(323 / 2 - 10, 222 / 2 - 10, 50, 20, "Continue", (clickData) -> this.setGameState(1)).setShouldClientCallback(true), 2);
this.addWidget(new LabelWidget(333 / 2, 222 / 2 - 50, "Game Paused", 0xFFFFFFFF).setXCentered(true), 2);
this.addWidget(new ClickButtonWidget(323 / 2 - 10, 222 / 2 - 10, 50, 20, "terminal.maze.continue", (clickData) -> this.setGameState(1)).setShouldClientCallback(true), 2);
this.addWidget(new LabelWidget(333 / 2, 222 / 2 - 50, "terminal.maze.pause", 0xFFFFFFFF).setXCentered(true), 2);
// GameState 3: Death
this.addWidget(new SimpleTextWidget(333 / 2, 232 / 2 - 40, "", 0xFFFFFFFF, () -> "Oh no! You were eaten by the Minotaur!", true), 3);
this.addWidget(new SimpleTextWidget(333 / 2, 232 / 2 - 28, "", 0xFFFFFFFF, () -> "You got through " + this.getMazesSolved() + " mazes before losing.", true), 3);
this.addWidget(new SimpleTextWidget(333 / 2, 232 / 2 - 16, "", 0xFFFFFFFF, () -> "Try again?", true), 3);
this.addWidget(new ClickButtonWidget(323 / 2 - 10, 222 / 2 + 10, 40, 20, "Retry", (clickData -> {
this.addWidget(new SimpleTextWidget(333 / 2, 232 / 2 - 40, "", 0xFFFFFFFF, () -> "terminal.maze.death.1", true), 3);
this.addWidget(new SimpleTextWidget(333 / 2, 232 / 2 - 28, "terminal.maze.death.2", 0xFFFFFFFF, () -> String.valueOf(this.getMazesSolved()),true), 3);
this.addWidget(new SimpleTextWidget(333 / 2, 232 / 2 - 16, "", 0xFFFFFFFF, () -> "terminal.maze.death.3", true), 3);
this.addWidget(new ClickButtonWidget(323 / 2 - 10, 222 / 2 + 10, 40, 20, "terminal.maze.retry", (clickData -> {
this.setGameState(1);
this.setMazesSolved(0);
MAZE_SIZE = 9;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package gregtech.common.terminal.app.game.minesweeper;

import gregtech.api.gui.widgets.SimpleTextWidget;
import gregtech.api.gui.widgets.WidgetGroup;
import gregtech.api.terminal.app.AbstractApplication;
import gregtech.common.terminal.app.game.minesweeper.widget.MineMapWidget;

public class MinesweeperApp extends AbstractApplication {
private MineMapWidget mineField;
private WidgetGroup textGroup;
private int timer;
private int resetCountdown = 100;

Expand All @@ -18,7 +20,9 @@ public AbstractApplication initApp() {
mineField = new MineMapWidget(20, 12, 40);
this.addWidget(mineField);
this.addWidget(new SimpleTextWidget(333 / 6, 10, "", 0xFFCCCCCC, this::getFlagsPercentage, true));
this.addWidget(new SimpleTextWidget(333 / 8 * 5, 10, "", 0xFFCCCCCC, this::getStatus, true));
textGroup = new WidgetGroup(0, 0, 200, 50);
this.addWidget(textGroup);
setTextStatus();

return this;
}
Expand All @@ -36,25 +40,36 @@ public void updateScreen() {
mineField.notifyWon();
}
resetCountdown--;
setTextStatus();
} else
timer++;
if (resetCountdown == 0) {
mineField.resetData();
resetCountdown = 100;
timer = 0;
setTextStatus();
}
}

public String getFlagsPercentage() {
return mineField.flagsPlaced + "/" + mineField.mineCount;
}

public String getStatus() {
return resetCountdown == 100 ?
(timer / 20) + " seconds elapsed" : // Normal
mineField.hasLost() ?
"You lost. Game will restart in " + resetCountdown / 20 + " seconds." : // Losing condition
"You won in " + (timer / 20) + " seconds! Game will restart in " + resetCountdown / 20; // Winning condition
public void setTextStatus() { //swap widget for localization
if (resetCountdown == 100) {
textGroup.clearAllWidgets();
textGroup.addWidget(new SimpleTextWidget(333 / 8 * 5, 10, "terminal.minesweeper.time", 0xFFCCCCCC, ()->String.valueOf(timer / 20), true)); // Normal
}
else if(resetCountdown==99){
textGroup.clearAllWidgets();
if(mineField.hasLost()){
textGroup.addWidget(new SimpleTextWidget(333 / 8 * 5, 10, "terminal.minesweeper.lose", 0xFFCCCCCC, ()->String.valueOf(resetCountdown / 20), true)); // Losing condition
} else{
textGroup.addWidget(new SimpleTextWidget(333 / 8 * 5, 10, "terminal.minesweeper.win.1", 0xFFCCCCCC, ()->String.valueOf(timer / 20), true)); // Winning condition
textGroup.addWidget(new SimpleTextWidget(333 / 8 * 5, 20, "terminal.minesweeper.win.2", 0xFFCCCCCC, ()->String.valueOf(resetCountdown / 20), true));
}
}

}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,13 @@ public ThemeSettings(TerminalOSWidget os) {
this.addColorButton(TerminalTheme.COLOR_B_3, "COLOR_B_3", (int) (x * 12), y);
this.addWidget(new LabelWidget(323 / 2, 75, "terminal.settings.theme.wallpaper", -1).setXCentered(true));
this.addWidget(new ImageWidget((int) x, 95, 150, 105, TerminalTheme.WALL_PAPER).setBorder(2, -1));
this.addWidget(new SelectorWidget((int) (x + 170), 95, 116, 20, Arrays.asList("resource", "url", "color", "file"), -1, TerminalTheme.WALL_PAPER::getTypeName, true)
this.addWidget(new SelectorWidget((int) (x + 170), 95, 116, 20,
Arrays.asList(
"terminal.settings.theme.wallpaper.resource",
"terminal.settings.theme.wallpaper.url",
"terminal.settings.theme.wallpaper.color",
"terminal.settings.theme.wallpaper.file"),
-1, this::getLocalizedWallpaperTypeName, true)
.setIsUp(true)
.setOnChanged(this::onModifyTextureChanged)
.setColors(TerminalTheme.COLOR_B_2.getColor(), TerminalTheme.COLOR_F_1.getColor(), TerminalTheme.COLOR_B_2.getColor())
Expand All @@ -50,6 +56,16 @@ public ThemeSettings(TerminalOSWidget os) {
this.addWidget(textureGroup);
}

private String getLocalizedWallpaperTypeName(){
switch(TerminalTheme.WALL_PAPER.getTypeName()){
case "resource": return "terminal.settings.theme.wallpaper.resource";
case "url": return "terminal.settings.theme.wallpaper.url";
case "color": return "terminal.settings.theme.wallpaper.color";
case "file": return "terminal.settings.theme.wallpaper.file";
}
return null;
}

private void addColorButton(ColorRectTexture texture, String name, int x, int y) {
CircleButtonWidget buttonWidget = new CircleButtonWidget(x, y, 8, 1, 0).setFill(texture.getColor()).setStrokeAnima(-1).setHoverText(name);
buttonWidget.setClickListener(cd -> TerminalDialogWidget.showColorDialog(os, name, color -> {
Expand All @@ -67,7 +83,7 @@ private void addColorButton(ColorRectTexture texture, String name, int x, int y)
private void onModifyTextureChanged(String type) {
textureGroup.clearAllWidgets();
switch (type) {
case "resource":
case "terminal.settings.theme.wallpaper.resource":
if (!(TerminalTheme.WALL_PAPER.getTexture() instanceof TextureArea)) {
TerminalTheme.WALL_PAPER.setTexture(new TextureArea(new ResourceLocation("gregtech:textures/gui/terminal/terminal_background.png"), 0.0, 0.0, 1.0, 1.0));
TerminalTheme.saveConfig();
Expand All @@ -78,7 +94,7 @@ private void onModifyTextureChanged(String type) {
TerminalTheme.saveConfig();
});
break;
case "url":
case "terminal.settings.theme.wallpaper.url":
if (!(TerminalTheme.WALL_PAPER.getTexture() instanceof URLTexture)) {
TerminalTheme.WALL_PAPER.setTexture(new URLTexture(null));
TerminalTheme.saveConfig();
Expand All @@ -88,7 +104,7 @@ private void onModifyTextureChanged(String type) {
TerminalTheme.saveConfig();
});
break;
case "color":
case "terminal.settings.theme.wallpaper.color":
ColorRectTexture texture;
if (!(TerminalTheme.WALL_PAPER.getTexture() instanceof ColorRectTexture)) {
texture = new ColorRectTexture(-1);
Expand All @@ -101,7 +117,7 @@ private void onModifyTextureChanged(String type) {
.setColorSupplier(texture::getColor, true)
.setOnColorChanged(texture::setColor));
break;
case "file":
case "terminal.settings.theme.wallpaper.file":
if (!(TerminalTheme.WALL_PAPER.getTexture() instanceof FileTexture)) {
TerminalTheme.WALL_PAPER.setTexture(new FileTexture(null));
TerminalTheme.saveConfig();
Expand Down
22 changes: 22 additions & 0 deletions src/main/resources/assets/gregtech/lang/en_us.lang
Original file line number Diff line number Diff line change
Expand Up @@ -5005,6 +5005,10 @@ terminal.settings.description=The system settings for GTOS.
terminal.settings.theme=Theme
terminal.settings.theme.color=Theme Color Settings
terminal.settings.theme.wallpaper=Wallpaper Settings
terminal.settings.theme.wallpaper.resource=resource
terminal.settings.theme.wallpaper.url=url
terminal.settings.theme.wallpaper.color=color
terminal.settings.theme.wallpaper.file=file
terminal.settings.theme.select=Select
terminal.settings.theme.image=Image File
terminal.settings.home=Home Button
Expand Down Expand Up @@ -5113,6 +5117,24 @@ terminal.vtank_viewer.refresh=Refresh tank index
terminal.teleporter.dimension=Dimension:
terminal.teleporter.spawn_portal=Engage

terminal.maze.title=Theseus's Escape
terminal.maze.play=Play
terminal.maze.continue=Continue
terminal.maze.pause=Game Paused
terminal.maze.death.1=Oh no! You were eaten by the Minotaur!
terminal.maze.death.2=You got through %s mazes before losing.
terminal.maze.death.3=Try again?
terminal.maze.retry=Retry

terminal.minesweeper.time=%s seconds elapsed
terminal.minesweeper.lose=You lost. Game will restart in %s seconds.
terminal.minesweeper.win.1=You won in %s seconds!
terminal.minesweeper.win.2=Game will restart in %s

terminal.cape_selector.empty=It looks like you haven't unlocked any capes yet!
terminal.cape_selector.select=Click on an unlocked cape to select it!
terminal.cape_selector.tip=You can get these from high-level advancements.

metaitem.cover.digital.title.mode=Mode:
metaitem.cover.digital.title.spin=Spin:
metaitem.cover.digital.wireless.tooltip.1=§eRight click on the central monitor to bind remotely to it.
Expand Down
24 changes: 23 additions & 1 deletion src/main/resources/assets/gregtech/lang/ja_jp.lang
Original file line number Diff line number Diff line change
Expand Up @@ -4870,7 +4870,7 @@ gregtech.terminal.app_name.ore_prospector=鉱石探査
gregtech.terminal.app_name.fluid_prospector=液体探査
gregtech.terminal.app_name.pong=ポン
gregtech.terminal.app_name.minesweeper=マインスイーパー
gregtech.terminal.app_name.maze=テセウスの迷宮
gregtech.terminal.app_name.maze=テセウスの脱出


gregtech.terminal.app_name.console=GTコンソール
Expand Down Expand Up @@ -4952,6 +4952,10 @@ terminal.settings.description=GTOSのシステム設定.
terminal.settings.theme=テーマ
terminal.settings.theme.color=テーマカラーの設定
terminal.settings.theme.wallpaper=壁紙設定
terminal.settings.theme.wallpaper.resource=リソース
terminal.settings.theme.wallpaper.url=url
terminal.settings.theme.wallpaper.color=単色
terminal.settings.theme.wallpaper.file=ファイル
terminal.settings.theme.select=選択
terminal.settings.theme.image=画像ファイル
terminal.settings.home=ホームボタン
Expand Down Expand Up @@ -5057,6 +5061,24 @@ terminal.vtank_viewer.description=エンダーリンクの周波数を変更し
terminal.vtank_viewer.title=バーチャルタンクビューア
terminal.vtank_viewer.refresh=再読み込み

terminal.maze.title=テセウスの脱出
terminal.maze.play=プレイ
terminal.maze.continue=ゲーム再開
terminal.maze.pause=PAUSE
terminal.maze.death.1=なんてことだ! ミノタウロスに食われてしまった!
terminal.maze.death.2=生きている間に%sの迷路を突破した.
terminal.maze.death.3=再挑戦する?
terminal.maze.retry=リトライ

terminal.minesweeper.time=%s秒経過
terminal.minesweeper.lose=失敗! %s秒後にリスタートします.
terminal.minesweeper.win.1=%s秒で勝利しました!
terminal.minesweeper.win.2=%s秒後にリスタートします.

terminal.cape_selector.empty=まだマントを一つも持っていません!
terminal.cape_selector.select=マントをクリックして選択してください!
terminal.cape_selector.tip=象徴的な実績を達成することでマントを獲得できます.

metaitem.cover.digital.title.mode=モード:
metaitem.cover.digital.title.spin=回転:
metaitem.cover.digital.wireless.tooltip.1=§eセントラルモニターを右クリックすることで無線でリンクできます.
Expand Down
22 changes: 22 additions & 0 deletions src/main/resources/assets/gregtech/lang/ru_ru.lang
Original file line number Diff line number Diff line change
Expand Up @@ -4959,6 +4959,10 @@ terminal.settings.description=Системные настройки для те
terminal.settings.theme=Тема
terminal.settings.theme.color=Настройка цветов терминала
terminal.settings.theme.wallpaper=Настройка фона
terminal.settings.theme.wallpaper.resource=resource
terminal.settings.theme.wallpaper.url=url
terminal.settings.theme.wallpaper.color=color
terminal.settings.theme.wallpaper.file=file
terminal.settings.theme.select=Выбрать изображение
terminal.settings.theme.image=Изображение
terminal.settings.home=Кнопка домой
Expand Down Expand Up @@ -5064,6 +5068,24 @@ terminal.vtank_viewer.description=Never lose any fluids to changing ender link f
terminal.vtank_viewer.title=Виртуальный просмотр резервуаров
terminal.vtank_viewer.refresh=Обновить

terminal.maze.title=Theseus's Escape
terminal.maze.play=Play
terminal.maze.continue=Continue
terminal.maze.pause=Game Paused
terminal.maze.death.1=Oh no! You were eaten by the Minotaur!
terminal.maze.death.2=You got through %s mazes before losing.
terminal.maze.death.3=Try again?
terminal.maze.retry=Retry

terminal.minesweeper.time=%s seconds elapsed
terminal.minesweeper.lose=You lost. Game will restart in %s seconds.
terminal.minesweeper.win.1=You won in %s seconds!
terminal.minesweeper.win.2=Game will restart in %s

terminal.cape_selector.empty=It looks like you haven't unlocked any capes yet!
terminal.cape_selector.select=Click on an unlocked cape to select it!
terminal.cape_selector.tip=You can get these from high-level advancements.

metaitem.cover.digital.title.mode=Режим:
metaitem.cover.digital.title.spin=Поворот:
metaitem.cover.digital.wireless.tooltip.1=§eЩелкните правой кнопкой мыши на центральный монитор, чтобы привязаться к нему.
Expand Down
22 changes: 22 additions & 0 deletions src/main/resources/assets/gregtech/lang/zh_cn.lang
Original file line number Diff line number Diff line change
Expand Up @@ -5019,6 +5019,10 @@ terminal.settings.description=GTOS的系统设置
terminal.settings.theme=主题
terminal.settings.theme.color=主题颜色设置
terminal.settings.theme.wallpaper=壁纸设置
terminal.settings.theme.wallpaper.resource=资源
terminal.settings.theme.wallpaper.url=网址
terminal.settings.theme.wallpaper.color=单色
terminal.settings.theme.wallpaper.file=文件
terminal.settings.theme.select=选择
terminal.settings.theme.image=图像文件
terminal.settings.home=主页按钮
Expand Down Expand Up @@ -5124,6 +5128,24 @@ terminal.vtank_viewer.description=永远不要再次失去任何末影流体连
terminal.vtank_viewer.title=虚拟容器查看器
terminal.vtank_viewer.refresh=刷新容器指数

terminal.maze.title=提修斯的逃跑
terminal.maze.play=开始
terminal.maze.continue=继续
terminal.maze.pause=暂停
terminal.maze.death.1=天啊! 你被弥诺陶洛斯吃掉了!
terminal.maze.death.2=你在死之前破解了%s个迷宫。
terminal.maze.death.3=再玩一次?
terminal.maze.retry=重试

terminal.minesweeper.time=%s秒经过
terminal.minesweeper.lose=你输了。游戏将在%s秒后重新开始.
terminal.minesweeper.win.1=你在%s秒内赢了!
terminal.minesweeper.win.2=游戏将在%s秒后重新开始.

terminal.cape_selector.empty=看来你还没有开放任何披风!
terminal.cape_selector.select=点击已开放的披风以选择!
terminal.cape_selector.tip=你可以经过获得困难的进度以开放披风。

metaitem.cover.digital.title.mode=模式:
metaitem.cover.digital.title.spin=自旋:
metaitem.cover.digital.wireless.tooltip.1=§e右击中央监视器以远程绑定到它。
Expand Down

0 comments on commit bd88d5a

Please sign in to comment.