From 9088d5ef805ced29e2b4abe5d88e84446bb64c3c Mon Sep 17 00:00:00 2001 From: mini-bomba <55105495+mini-bomba@users.noreply.github.com> Date: Fri, 12 Jun 2020 14:54:07 +0200 Subject: [PATCH] Made debug overlay able to be translated --- src/js/game/hud/parts/debug_info.js | 21 ++++++++++++--------- translations/base-en.yaml | 10 ++++++++++ 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/js/game/hud/parts/debug_info.js b/src/js/game/hud/parts/debug_info.js index 4f4c052e..4830d40a 100644 --- a/src/js/game/hud/parts/debug_info.js +++ b/src/js/game/hud/parts/debug_info.js @@ -3,6 +3,7 @@ import { makeDiv, round3Digits, round2Digits } from "../../../core/utils"; import { Math_round } from "../../../core/builtins"; import { DynamicDomAttach } from "../dynamic_dom_attach"; import { KEYMAPPINGS } from "../../key_action_mapper"; +import { T } from "../../../translations.js"; export class HUDDebugInfo extends BaseHUDPart { createElements(parent) { @@ -31,15 +32,17 @@ export class HUDDebugInfo extends BaseHUDPart { const now = this.root.time.realtimeNow(); if (now - this.lastTick > 0.25 && this.visible) { this.lastTick = now; - this.tickRateElement.innerText = "Tickrate: " + this.root.dynamicTickrate.currentTickRate; - this.fpsElement.innerText = - "FPS: " + - Math_round(this.root.dynamicTickrate.averageFps) + - " (" + - round2Digits(1000 / this.root.dynamicTickrate.averageFps) + - " ms)"; - this.tickDurationElement.innerText = - "Tick Dur: " + round3Digits(this.root.dynamicTickrate.averageTickDuration) + "ms"; + this.tickRateElement.innerText = T.ingame.debug.tickrate.replace( + "", + this.root.dynamicTickrate.currentTickRate.toString() + ); + this.fpsElement.innerText = T.ingame.debug.fps + .replace("", Math_round(this.root.dynamicTickrate.averageFps).toString()) + .replace("", round2Digits(1000 / this.root.dynamicTickrate.averageFps).toString()); + this.tickDurationElement.innerText = T.ingame.debug.tickDuration.replace( + "", + round3Digits(this.root.dynamicTickrate.averageTickDuration).toString() + ); } } } diff --git a/translations/base-en.yaml b/translations/base-en.yaml index d10aea1d..c878d842 100644 --- a/translations/base-en.yaml +++ b/translations/base-en.yaml @@ -381,6 +381,16 @@ ingame: 1_3_expand: >- This is NOT an idle game! Build more extractors and belts to finish the goal quicker.

Tip: Hold SHIFT to place multiple extractors, and use R to rotate them. + # The debug overlay (F4) + # This doesn't need to be translated. + debug: + tickrate: >- + Tickrate: + tickDuration: >- + Tick Dur: ms + fps: >- + FPS: ( ms) + # All shop upgrades shopUpgrades: belt: