Добавить постоянную локализацию RU и EN
This commit is contained in:
@@ -0,0 +1,253 @@
|
||||
package com.projectsacrifice.game;
|
||||
|
||||
/** All player-facing copy behind one typed, Android-independent interface. */
|
||||
public final class GameStrings {
|
||||
private static final String[] EN_TITLES = {
|
||||
"The Volunteer", "A Useful End", "Dead Weight", "The Long Lift",
|
||||
"Express Delivery", "Cold Comfort", "Live Wire", "Borrowed Time",
|
||||
"Two Good Reasons", "The Last Procession"
|
||||
};
|
||||
private static final String[] RU_TITLES = {
|
||||
"Рыцарь-доброволец", "Полезный конец", "Мёртвый груз", "Долгий подъём",
|
||||
"Срочная доставка", "Холодное утешение", "Живой провод", "Время взаймы",
|
||||
"Две веские причины", "Последнее шествие"
|
||||
};
|
||||
private static final String[] EN_HINTS = {
|
||||
"Reach the relic. Arrows move; the winged button jumps.",
|
||||
"The spikes keep every volunteer. Build a path from what remains.",
|
||||
"Leave a body on the brass plate so the next volunteer can pass.",
|
||||
"Touch the lever, then ride the moving platform to the upper gallery.",
|
||||
"The saw throws to the right. Deliver a volunteer to the distant plate.",
|
||||
"The frost makes a solid block. Use the frozen volunteer as a step.",
|
||||
"A fallen volunteer conducts the current and keeps the relay alive.",
|
||||
"Jump for the far blue relay if the timed gate closes.",
|
||||
"The final gate needs weight and power at the same time.",
|
||||
"Launch, freeze, conduct, ascend. Every lesson opens the last relic."
|
||||
};
|
||||
private static final String[] RU_HINTS = {
|
||||
"Доберитесь до реликвии. Стрелки двигают; кнопка с крылом — прыжок.",
|
||||
"Шипы сохраняют каждого добровольца. Проложите путь из того, что осталось.",
|
||||
"Оставьте тело на латунной плите, чтобы следующий доброволец прошёл.",
|
||||
"Коснитесь рычага, затем поднимитесь на платформе к верхней галерее.",
|
||||
"Пила бросает вправо. Доставьте добровольца на дальнюю плиту.",
|
||||
"Мороз создаёт твёрдый блок. Используйте замёрзшего добровольца как ступень.",
|
||||
"Павший доброволец проводит ток и поддерживает реле.",
|
||||
"Прыгните к дальнему синему реле, если ворота по таймеру закроются.",
|
||||
"Последним воротам одновременно нужны вес и питание.",
|
||||
"Разгонитесь, замёрзните, проведите ток, поднимитесь. Каждый урок открывает последнюю реликвию."
|
||||
};
|
||||
|
||||
private final GameLanguage language;
|
||||
|
||||
private GameStrings(GameLanguage language) {
|
||||
this.language = language == null ? GameLanguage.EN : language;
|
||||
}
|
||||
|
||||
public static GameStrings forLanguage(GameLanguage language) {
|
||||
return new GameStrings(language);
|
||||
}
|
||||
|
||||
public GameLanguage language() {
|
||||
return language;
|
||||
}
|
||||
|
||||
private boolean russian() {
|
||||
return language == GameLanguage.RU;
|
||||
}
|
||||
|
||||
public String appContentDescription() {
|
||||
return russian()
|
||||
? "Project Sacrifice. Платформенная головоломка из десяти уровней."
|
||||
: "Project Sacrifice. Ten-level puzzle platform game.";
|
||||
}
|
||||
|
||||
public String projectTitle() { return "PROJECT SACRIFICE"; }
|
||||
public String tagline() {
|
||||
return russian() ? "Каждый конец оставляет путь вперёд"
|
||||
: "Every ending leaves a way forward";
|
||||
}
|
||||
public String locked() { return russian() ? "ЗАКРЫТО" : "LOCKED"; }
|
||||
public String tapToEnter() { return russian() ? "Нажмите, чтобы войти" : "Tap to enter"; }
|
||||
public String levelSelectFooter() {
|
||||
return russian()
|
||||
? "Альбомная ориентация · мультитач · прогресс сохраняется автоматически"
|
||||
: "Landscape · multitouch · progress saves automatically";
|
||||
}
|
||||
|
||||
public String settingsButton() {
|
||||
return russian() ? "Настройки" : "Settings";
|
||||
}
|
||||
|
||||
public String settingsTitle() { return russian() ? "НАСТРОЙКИ" : "SETTINGS"; }
|
||||
public String settingsInstruction() {
|
||||
return russian() ? "Нажмите на строку, чтобы изменить. Всё сохраняется автоматически."
|
||||
: "Tap a row to change it. Changes save automatically.";
|
||||
}
|
||||
public String controlSizeSetting() { return russian() ? "Размер управления" : "Control size"; }
|
||||
public String controlOpacitySetting() { return russian() ? "Прозрачность управления" : "Control opacity"; }
|
||||
public String vibrationSetting() { return russian() ? "Вибрация" : "Vibration"; }
|
||||
public String languageSetting() { return russian() ? "Язык" : "Language"; }
|
||||
public String languageName() { return russian() ? "Русский" : "English"; }
|
||||
public String controlSizeValue(int index) {
|
||||
String[] values = russian()
|
||||
? new String[]{"Маленький", "Средний", "Большой"}
|
||||
: new String[]{"Small", "Medium", "Large"};
|
||||
return values[validPreset(index)];
|
||||
}
|
||||
public String controlOpacityValue(int index) {
|
||||
String[] values = russian()
|
||||
? new String[]{"Низкая", "Средняя", "Высокая"}
|
||||
: new String[]{"Low", "Medium", "High"};
|
||||
return values[validPreset(index)];
|
||||
}
|
||||
public String hapticsValue(boolean enabled) {
|
||||
if (russian()) return enabled ? "Вкл." : "Выкл.";
|
||||
return enabled ? "On" : "Off";
|
||||
}
|
||||
public String back() { return russian() ? "Назад" : "Back"; }
|
||||
|
||||
public String hudStats(int deaths, long elapsedMilliseconds) {
|
||||
if (russian()) {
|
||||
return "Добровольцы " + deaths + " Время " + GameMath.formatTime(elapsedMilliseconds);
|
||||
}
|
||||
return "Volunteers " + deaths + " Time " + GameMath.formatTime(elapsedMilliseconds);
|
||||
}
|
||||
public String restart() { return russian() ? "Заново" : "Restart"; }
|
||||
public String respawning() {
|
||||
return russian() ? "Следующий доброволец уже в пути…"
|
||||
: "Another volunteer is on the way…";
|
||||
}
|
||||
|
||||
public String levelBestStats(int deaths, long elapsedMilliseconds) {
|
||||
return "✓ " + deaths + " " + volunteerWord(deaths) + " · "
|
||||
+ GameMath.formatTime(elapsedMilliseconds);
|
||||
}
|
||||
public String relicClaimed() { return russian() ? "РЕЛИКВИЯ ПОЛУЧЕНА" : "RELIC CLAIMED"; }
|
||||
public String completion() { return russian() ? "Завершение ★" : "Completion ★"; }
|
||||
public String completionDeaths(boolean earned, int deaths, int targetDeaths) {
|
||||
return (earned ? "★" : "☆") + " " + deaths + " / " + targetDeaths + " "
|
||||
+ volunteerWord(deaths);
|
||||
}
|
||||
public String completionTime(boolean earned, long elapsedMilliseconds, long targetMilliseconds) {
|
||||
return (earned ? "★" : "☆") + " " + GameMath.formatTime(elapsedMilliseconds)
|
||||
+ " / " + GameMath.formatTime(targetMilliseconds);
|
||||
}
|
||||
public String levelSelect() { return russian() ? "Выбор уровня" : "Level select"; }
|
||||
public String replay() { return russian() ? "Повторить" : "Replay"; }
|
||||
public String nextLevel() { return russian() ? "Следующий уровень" : "Next level"; }
|
||||
public String paused() { return russian() ? "ПАУЗА" : "PAUSED"; }
|
||||
public String resume() { return russian() ? "Продолжить" : "Resume"; }
|
||||
|
||||
// Result-flow hooks used by the Stage 3 result screen.
|
||||
public String currentResult() { return russian() ? "Текущий результат" : "Current result"; }
|
||||
public String bestResult() { return russian() ? "Лучший результат" : "Best result"; }
|
||||
public String deathsStat() { return russian() ? "Добровольцы" : "Volunteers"; }
|
||||
public String timeStat() { return russian() ? "Время" : "Time"; }
|
||||
public String newBest() { return russian() ? "НОВЫЙ РЕКОРД" : "NEW BEST"; }
|
||||
|
||||
public String currentResultLine(int deaths, long timeMs) {
|
||||
return currentResult() + " · " + deaths + " " + volunteerWord(deaths)
|
||||
+ " · " + GameMath.formatTime(timeMs);
|
||||
}
|
||||
|
||||
public String bestResultLine(int deaths, long timeMs) {
|
||||
return bestResult() + " · " + deaths + " " + volunteerWord(deaths)
|
||||
+ " · " + GameMath.formatTime(timeMs);
|
||||
}
|
||||
|
||||
public String targetsResultLine(int deaths, long timeMs) {
|
||||
String label = russian() ? "Цели" : "Targets";
|
||||
return label + " · " + deaths + " " + volunteerWord(deaths)
|
||||
+ " · " + GameMath.formatTime(timeMs);
|
||||
}
|
||||
|
||||
public String nextGoalDeaths(long deaths) {
|
||||
return russian()
|
||||
? "Следующая цель · пройти с " + deaths + " добровольцами"
|
||||
: "Next goal · finish with " + deaths + " volunteers";
|
||||
}
|
||||
|
||||
public String nextGoalTime(long timeMs) {
|
||||
return (russian() ? "Следующая цель · пройти за " : "Next goal · finish in ")
|
||||
+ GameMath.formatTime(timeMs);
|
||||
}
|
||||
|
||||
public String nextGoalLevel(long level) {
|
||||
return (russian() ? "Следующая цель · перейти на уровень "
|
||||
: "Next goal · enter level ") + level;
|
||||
}
|
||||
|
||||
public String nextGoalPersonalBest() {
|
||||
return russian() ? "Следующая цель · улучшить личный рекорд"
|
||||
: "Next goal · improve your personal best";
|
||||
}
|
||||
|
||||
// Onboarding hooks keep new tutorial Canvas copy out of GameView conditionals.
|
||||
public String tutorialWelcomeTitle() {
|
||||
return russian() ? "Смерть — это инструмент" : "Death is a tool";
|
||||
}
|
||||
public String tutorialWelcomeBody() {
|
||||
return russian()
|
||||
? "Двигайтесь стрелками и прыгайте кнопкой с крылом. Доберитесь до реликвии."
|
||||
: "Move with the arrows and jump with the winged button. Reach the relic.";
|
||||
}
|
||||
public String tutorialSacrificeTitle() {
|
||||
return russian() ? "Оставьте путь вперёд" : "Leave a way forward";
|
||||
}
|
||||
public String tutorialSacrificeBody() {
|
||||
return russian()
|
||||
? "После смерти тело остаётся в мире: закрывает шипы, держит плиты и становится ступенью."
|
||||
: "A body stays in the world after death: cover spikes, hold plates, and make a step.";
|
||||
}
|
||||
public String tutorialSkip() { return russian() ? "Пропустить" : "Skip"; }
|
||||
public String tutorialNext() { return russian() ? "Далее" : "Next"; }
|
||||
public String tutorialStart() { return russian() ? "Начать" : "Start"; }
|
||||
public String tutorialDone() { return russian() ? "Готово" : "Done"; }
|
||||
public String tutorialMovementTitle() { return russian() ? "ДВИЖЕНИЕ" : "MOVE"; }
|
||||
public String tutorialMovementBody() {
|
||||
return russian() ? "Удерживайте левую или правую стрелку, чтобы двигаться."
|
||||
: "Hold the left or right arrow to explore.";
|
||||
}
|
||||
public String tutorialJumpTitle() { return russian() ? "ДВИЖЕНИЕ + ПРЫЖОК" : "MOVE + JUMP"; }
|
||||
public String tutorialJumpBody() {
|
||||
return russian() ? "Используйте два пальца: держите направление и нажмите Прыжок."
|
||||
: "Use two fingers: hold a direction and tap Jump.";
|
||||
}
|
||||
public String tutorialCorpseTitle() {
|
||||
return russian() ? "СМЕРТЬ ОСТАВЛЯЕТ ИНСТРУМЕНТ" : "DEATH LEAVES A TOOL";
|
||||
}
|
||||
public String tutorialCorpseBody() {
|
||||
return russian() ? "Павший доброволец остаётся. Используйте тело, чтобы открыть путь."
|
||||
: "A fallen volunteer remains. Use the body to open a path.";
|
||||
}
|
||||
public String tutorialProgress(int step, int total) {
|
||||
return step + " / " + total;
|
||||
}
|
||||
|
||||
public String levelTitle(int oneBasedLevelNumber) {
|
||||
return (russian() ? RU_TITLES : EN_TITLES)[levelIndex(oneBasedLevelNumber)];
|
||||
}
|
||||
|
||||
public String levelHint(int oneBasedLevelNumber) {
|
||||
return (russian() ? RU_HINTS : EN_HINTS)[levelIndex(oneBasedLevelNumber)];
|
||||
}
|
||||
|
||||
private String volunteerWord(int count) {
|
||||
if (!russian()) return count == 1 ? "volunteer" : "volunteers";
|
||||
int mod100 = Math.abs(count) % 100;
|
||||
int mod10 = Math.abs(count) % 10;
|
||||
if (mod100 >= 11 && mod100 <= 14) return "добровольцев";
|
||||
if (mod10 == 1) return "доброволец";
|
||||
if (mod10 >= 2 && mod10 <= 4) return "добровольца";
|
||||
return "добровольцев";
|
||||
}
|
||||
|
||||
private static int validPreset(int index) {
|
||||
return index >= 0 && index <= 2 ? index : 1;
|
||||
}
|
||||
|
||||
private static int levelIndex(int oneBasedLevelNumber) {
|
||||
int index = oneBasedLevelNumber - 1;
|
||||
return index >= 0 && index < EN_TITLES.length ? index : 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user