diff --git a/src/Countdown.tsx b/src/Countdown.tsx
index 5a7e88e..5e03f86 100644
--- a/src/Countdown.tsx
+++ b/src/Countdown.tsx
@@ -6,7 +6,14 @@ import FONT_FAMILY from "./font";
import { GIT_HASH } from "./config";
import { calculateAgeLocal } from "./calculate-age";
import { colorBackground, colorPrimary, colorSecondary } from "./colors";
-import { AGE, SOURCE_CODE } from "./translation";
+import {
+ AGE,
+ COPY_LABEL,
+ SOURCE_CODE,
+ BIRTH_DAY_FORMAT,
+ AGE_COPIED,
+ AGE_COPY_FAILED,
+} from "./translation";
const animationLoop = (cb: (time: DOMHighResTimeStamp) => void) => {
let handle: number;
@@ -18,8 +25,6 @@ const animationLoop = (cb: (time: DOMHighResTimeStamp) => void) => {
return () => cancelAnimationFrame(handle);
};
-const COPY_LABEL = "Click to copy age to clipboard";
-
export default ({
birthDay,
openSettings,
@@ -42,9 +47,9 @@ export default ({
const ageString = `${largeAge()}.${smallAge()}`;
try {
await navigator.clipboard.writeText(ageString);
- toast.success("Age copied to clipboard!");
+ toast.success(AGE_COPIED);
} catch (err) {
- toast.error("Failed to copy age to clipboard!");
+ toast.error(AGE_COPY_FAILED);
}
};
return (
@@ -76,7 +81,7 @@ export default ({
color: colorSecondary(),
"margin-left": "4px",
}}
- title={`Birthday: ${birthDay.toLocaleString()}`}
+ title={BIRTH_DAY_FORMAT(birthDay)}
>
{AGE}
- Enter your Birthday
+ {ENTER_BIRTHDAY}
- Motivate
+ {MOTIVATE}
);
diff --git a/src/translation/en.ts b/src/translation/en.ts
index 92a37e0..565287a 100644
--- a/src/translation/en.ts
+++ b/src/translation/en.ts
@@ -1,2 +1,11 @@
+import type { Temporal } from "temporal-polyfill";
+
export const AGE = "Age";
export const SOURCE_CODE = "source code";
+export const COPY_LABEL = "Click to copy age to clipboard";
+export const BIRTH_DAY_FORMAT = (birthDay: Temporal.PlainDate) =>
+ `Birthday: ${birthDay.toLocaleString()}`;
+export const AGE_COPIED = "Age copied to clipboard!";
+export const AGE_COPY_FAILED = "Failed to copy age to clipboard!";
+export const ENTER_BIRTHDAY = "Enter your Birthday";
+export const MOTIVATE = "Motivate";
diff --git a/src/translation/index.ts b/src/translation/index.ts
index 7f30f32..3290495 100644
--- a/src/translation/index.ts
+++ b/src/translation/index.ts
@@ -23,7 +23,7 @@ let data;
switch (path) {
// TODO: remove workaround for TypeScript limitation
case "./en":
- data = await import("./en");
+ data = await import("./ru");
break;
case "./ru":
data = await import("./ru");
@@ -32,4 +32,13 @@ switch (path) {
throw new Error("Language not supported");
}
-export const { AGE, SOURCE_CODE } = data;
+export const {
+ AGE,
+ SOURCE_CODE,
+ COPY_LABEL,
+ BIRTH_DAY_FORMAT,
+ AGE_COPIED,
+ AGE_COPY_FAILED,
+ ENTER_BIRTHDAY,
+ MOTIVATE,
+} = data;
diff --git a/src/translation/ru.ts b/src/translation/ru.ts
index 4d55aea..7a866ca 100644
--- a/src/translation/ru.ts
+++ b/src/translation/ru.ts
@@ -1,2 +1,11 @@
+import type { Temporal } from "temporal-polyfill";
+
export const AGE = "Возраст";
export const SOURCE_CODE = "исходный код";
+export const COPY_LABEL = "Нажмите, чтобы скопировать возраст в буфер обмена";
+export const BIRTH_DAY_FORMAT = (birthDay: Temporal.PlainDate) =>
+ `День рождения: ${birthDay.toLocaleString()}`;
+export const AGE_COPIED = "Возраст скопирован в буфер обмена!";
+export const AGE_COPY_FAILED = "Не удалось скопировать возраст в буфер обмена!";
+export const ENTER_BIRTHDAY = "Введите свой день рождения";
+export const MOTIVATE = "Мотивировать";