pleshevski.ru/old/context.ts

26 lines
461 B
TypeScript
Raw Normal View History

import { Translations } from "./translates/rus.ts";
export interface Context {
2023-02-03 03:09:57 +03:00
title?: string;
locPath: string;
lang: Lang;
tr: Translations;
}
export function getLangHref(lang: Lang, url: string): string {
return getLangUrlPrefix(lang) + url;
}
export function getLangUrlPrefix(lang: Lang): string {
2022-06-18 15:22:35 +03:00
return `/${lang}`;
}
export function iterLangs(): Lang[] {
return [Lang.Eng, Lang.Rus];
}
export enum Lang {
Rus = "rus",
Eng = "eng",
}