feat(intro): use i18n

This commit is contained in:
2026-01-12 16:24:01 +01:00
parent b6c0a459a4
commit 81b7873e6f
2 changed files with 9 additions and 7 deletions

View File

@@ -36,8 +36,7 @@ onRender((ctx) => {
ctx.font = "12px NDS12 Bold";
ctx.letterSpacing = "1px";
const TEXT = "WARNING - COPYRIGHT";
const { actualBoundingBoxRight: width } = ctx.measureText(TEXT);
const { actualBoundingBoxRight: width } = ctx.measureText($t("intro.copyright"));
const logoWidth = assets.images.intro.warning.rect.width;
const logoX = Math.floor(LOGICAL_WIDTH / 2 - (width + logoWidth + 3) / 2);
@@ -49,15 +48,13 @@ onRender((ctx) => {
: 1;
assets.images.intro.warning.draw(ctx, logoX, TITLE_Y - 1);
ctx.fillText(TEXT, logoX + logoWidth + 3, TITLE_Y);
ctx.fillText($t("intro.copyright"), logoX + logoWidth + 3, TITLE_Y);
ctx.letterSpacing = "0px";
// text
ctx.font = "10px NDS10";
const TEXT2 =
"THIS IS A NON-COMMERCIAL FAN-MADE\nRECREATION. NOT AFFILIATED WITH\nOR ENDORSED BY NINTENDO.\nNINTENDO DS IS A TRADEMARK OF\nNINTENDO CO., LTD.";
const lines = TEXT2.split("\n");
const lines = $t("intro.text").split("\n");
for (let i = 0, y = TEXT_Y; i < lines.length; i += 1, y += 18)
fillTextHCentered(ctx, lines[i]!, 0, y, LOGICAL_WIDTH);
@@ -70,7 +67,7 @@ onRender((ctx) => {
: hintTextOpacity.value;
fillTextHCentered(
ctx,
"Touch the Touch Screen to continue.",
$t("intro.hint"),
0,
HINT_Y,
LOGICAL_WIDTH,

View File

@@ -1,4 +1,9 @@
{
"intro": {
"copyright": "WARNING - COPYRIGHT",
"text": "THIS IS A NON-COMMERCIAL FAN-MADE\nRECREATION. NOT AFFILIATED WITH\nOR ENDORSED BY NINTENDO.\nNINTENDO DS IS A TRADEMARK OF\nNINTENDO CO., LTD.",
"hint": "Touch the Touch Screen to continue."
},
"home": {
"projectsAndExperiences": "Projects and\nExperiences",
"greeting": "Welcome to my website!",