first udpate
This commit is contained in:
+24
@@ -0,0 +1,24 @@
|
||||
import ar from "@/content/ar";
|
||||
import en from "@/content/en";
|
||||
import type { Dictionary } from "@/content/types";
|
||||
|
||||
export const locales = ["ar", "en"] as const;
|
||||
|
||||
export type Locale = (typeof locales)[number];
|
||||
|
||||
const dictionaries: Record<Locale, Dictionary> = {
|
||||
ar,
|
||||
en,
|
||||
};
|
||||
|
||||
export function isLocale(value: string): value is Locale {
|
||||
return locales.includes(value as Locale);
|
||||
}
|
||||
|
||||
export function getDictionary(locale: Locale): Dictionary {
|
||||
return dictionaries[locale];
|
||||
}
|
||||
|
||||
export function getDirection(locale: Locale): "rtl" | "ltr" {
|
||||
return locale === "ar" ? "rtl" : "ltr";
|
||||
}
|
||||
Reference in New Issue
Block a user