Dmitriy Pleshevskiy
890c1f74ed
All checks were successful
continuous-integration/drone/push Build is passing
Closes #1 Reviewed-on: #2 Co-authored-by: Dmitriy Pleshevskiy <dmitriy@ideascup.me> Co-committed-by: Dmitriy Pleshevskiy <dmitriy@ideascup.me>
24 lines
468 B
TypeScript
24 lines
468 B
TypeScript
import { Translations } from "./translates/rus.ts";
|
|
|
|
export interface Context {
|
|
locPath: string;
|
|
lang: Lang;
|
|
tr: Translations;
|
|
}
|
|
|
|
export function getLangHref(lang: Lang, url: string): string {
|
|
return getLangUrlPrefix(lang) + url;
|
|
}
|
|
|
|
export function getLangUrlPrefix(lang: Lang): string {
|
|
return lang === Lang.Rus ? "" : `/${lang}`;
|
|
}
|
|
|
|
export function iterLangs(): Lang[] {
|
|
return [Lang.Eng, Lang.Rus];
|
|
}
|
|
|
|
export enum Lang {
|
|
Rus = "rus",
|
|
Eng = "eng",
|
|
}
|