feat: add Spanish i18n (#157)

* Create es.ts

Added Spanish translation for site content and interface elements.

* Update translation.ts

Added Spanish (es) translation support to the language configuration.
This commit is contained in:
Marcos
2024-08-27 18:22:43 +02:00
committed by GitHub
parent e9c8930559
commit 075cb8e10a
2 changed files with 42 additions and 2 deletions

View File

@@ -1,10 +1,11 @@
import { siteConfig } from '../config'
import type I18nKey from './i18nKey'
import { en } from './languages/en'
import { es } from './languages/es'
import { ja } from './languages/ja'
import { ko } from './languages/ko'
import { zh_CN } from './languages/zh_CN'
import { zh_TW } from './languages/zh_TW'
import { ko } from './languages/ko'
export type Translation = {
[K in I18nKey]: string
@@ -13,6 +14,7 @@ export type Translation = {
const defaultTranslation = en
const map: { [key: string]: Translation } = {
es: es,
en: en,
en_us: en,
en_gb: en,
@@ -32,4 +34,4 @@ export function getTranslation(lang: string): Translation {
export function i18n(key: I18nKey): string {
const lang = siteConfig.lang || 'en'
return getTranslation(lang)[key]
}
}