Skip to content

Commit

Permalink
Add Ukrainian language 🇺🇦
Browse files Browse the repository at this point in the history
  • Loading branch information
adipascu committed Jan 16, 2024
1 parent e8f9919 commit 7658815
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/assertUnreachable.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function assertUnreachable(value: never): never {
throw new Error(`This value is unsupported ${value}`);
}
9 changes: 7 additions & 2 deletions src/translation/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const SUPPORTED_LANGUAGES = ["en", "ru"] as const;
import assertUnreachable from "../assertUnreachable";

const SUPPORTED_LANGUAGES = ["en", "ru", "uk"] as const;
const DEFAULT_LANGUAGE = "en";

const PREFERRED_LANGUAGES = window.navigator.languages.map((lang) =>
Expand Down Expand Up @@ -28,8 +30,11 @@ switch (path) {
case "./ru":
data = await import("./ru");
break;
case "./uk":
data = await import("./uk");
break;
default:
throw new Error("Language not supported");
assertUnreachable(path);
}

export const {
Expand Down
11 changes: 11 additions & 0 deletions src/translation/uk.ts
Original file line number Diff line number Diff line change
@@ -0,0 +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 = "Мотивуйте";

0 comments on commit 7658815

Please sign in to comment.