diff options
| author | Ariel Costas Guerrero <94913521+arielcostas@users.noreply.github.com> | 2025-03-14 23:33:56 +0100 |
|---|---|---|
| committer | Ariel Costas Guerrero <94913521+arielcostas@users.noreply.github.com> | 2025-03-14 23:33:56 +0100 |
| commit | e3c4bb2efa513973bc26949a8be62fbe66e31a4f (patch) | |
| tree | 75a46cbde3ec2d36cfd33bff63ae7c65d145c182 /src/i18n/index.ts | |
| parent | 54dab1e00b38693e96c801d0c5a020693a35bbda (diff) | |
Implement new page layouts for Home, Contact, Portfolio, and Trajectory; update header and footer for multilingual support
Diffstat (limited to 'src/i18n/index.ts')
| -rw-r--r-- | src/i18n/index.ts | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/i18n/index.ts b/src/i18n/index.ts new file mode 100644 index 0000000..4ed1a52 --- /dev/null +++ b/src/i18n/index.ts @@ -0,0 +1,34 @@ +import Spanish from './es.json'; +import English from './en.json'; + +export const SHOW_DEFAULT_LANGUAGE = false; +export const DEFAULT_LANGUAGE = "es"; + +export type LanguageKeys = "es" | "en"; + +export const languages: Record<LanguageKeys, { code: string, name: string }> = { + es: { + code: "es", + name: "EspaƱol" + }, + en: { + code: "en", + name: "English" + } +} + +export const LANGUAGE_CODES = Object.keys(languages); + +export const useTranslations = (lang: string | undefined) => { + switch (lang) { + case languages.en.code: + return English; + case languages.es.code: + default: + return Spanish; + } +} + +export function getUrlWithoutLocale(url: string) { + return url.replace(/\/[a-z]{2}\//, "/"); +}
\ No newline at end of file |
