All files / packages/app/utils i18n-data.ts

100% Statements 5/5
100% Branches 0/0
100% Functions 1/1
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95                                                              332x 332x         332x 17937x       332x                                                                                                        
import type adminEn from "@ra/web/public/locales/en/admin.json";
import type debtsEn from "@ra/web/public/locales/en/debts.json";
import type defaultEn from "@ra/web/public/locales/en/default.json";
import type emailEn from "@ra/web/public/locales/en/email.json";
import type loginEn from "@ra/web/public/locales/en/login.json";
import type peersEn from "@ra/web/public/locales/en/peers.json";
import type receiptsEn from "@ra/web/public/locales/en/receipts.json";
import type registerEn from "@ra/web/public/locales/en/register.json";
import type resetPasswordEn from "@ra/web/public/locales/en/reset-password.json";
import type settingsEn from "@ra/web/public/locales/en/settings.json";
// (*)
import type userEn from "@ra/web/public/locales/en/user.json";
import type voidUserEn from "@ra/web/public/locales/en/void-user.json";
import type adminRu from "@ra/web/public/locales/ru/admin.json";
import type debtsRu from "@ra/web/public/locales/ru/debts.json";
import type defaultRu from "@ra/web/public/locales/ru/default.json";
import type emailRu from "@ra/web/public/locales/ru/email.json";
import type loginRu from "@ra/web/public/locales/ru/login.json";
import type peersRu from "@ra/web/public/locales/ru/peers.json";
import type receiptsRu from "@ra/web/public/locales/ru/receipts.json";
import type registerRu from "@ra/web/public/locales/ru/register.json";
import type resetPasswordRu from "@ra/web/public/locales/ru/reset-password.json";
import type settingsRu from "@ra/web/public/locales/ru/settings.json";
import type userRu from "@ra/web/public/locales/ru/user.json";
import type voidUserRu from "@ra/web/public/locales/ru/void-user.json";
import { keys } from "remeda";
 
import type { AssertAllEqual } from "~utils/types";
 
// To add a language add amespace jsons, import at (*) and verification at (**)
export type Language = "en" | "ru";
export const baseLanguage = "en";
export const languages: Record<Language, true> = {
	en: true,
	ru: true,
};
 
export const isLanguage = (input: string): input is Language =>
	keys(languages).includes(input as Language);
 
// To add a namespace add name in the list, namespace json, import at (*) and verification at (**)
export type Namespace = keyof Resources;
export const defaultNamespace: Namespace = "default";
 
export type Resources = {
	default: typeof defaultEn;
	settings: typeof settingsEn;
	user: typeof userEn;
	admin: typeof adminEn;
	login: typeof loginEn;
	receipts: typeof receiptsEn;
	register: typeof registerEn;
	"reset-password": typeof resetPasswordEn;
	"void-user": typeof voidUserEn;
	peers: typeof peersEn;
	debts: typeof debtsEn;
	email: typeof emailEn;
};
 
type ValidatedResources = AssertAllEqual<
	// (**)
	[
		Resources,
		{
			default: typeof defaultRu;
			settings: typeof settingsRu;
			user: typeof userRu;
			admin: typeof adminRu;
			login: typeof loginRu;
			receipts: typeof receiptsRu;
			register: typeof registerRu;
			"reset-password": typeof resetPasswordRu;
			"void-user": typeof voidUserRu;
			peers: typeof peersRu;
			debts: typeof debtsRu;
			email: typeof emailRu;
		},
	]
>;
 
// Set to false if it's ok to have partial translations
type StrictTranslations = true;
 
declare module "i18next" {
	// oxlint-disable-next-line typescript/consistent-type-definitions
	interface CustomTypeOptions {
		defaultNS: "default";
		resources: StrictTranslations extends true
			? ValidatedResources extends never
				? never
				: Resources
			: Resources;
	}
}