Skip to content

Commit

Permalink
feat: add spanish language support
Browse files Browse the repository at this point in the history
  • Loading branch information
rtoscani committed Dec 2, 2023
1 parent 5c8d673 commit d5e7d7d
Show file tree
Hide file tree
Showing 11 changed files with 139 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/components/Feature/src/FeatureList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class="ob-gradient-plate opacity-90 relative z-10 bg-ob-deep-900 rounded-2xl flex justify-start items-end px-6 pb-10 shadow-md"
>
<h2 class="text-3xl pb-8 lg:pb-14">
<p :style="gradientText">EDITOR'S SELECTION</p>
<p :style="gradientText">{{ t('home.editor_selection') }}</p>
<span class="relative text-lg text-ob-bright font-semibold">
<SvgIcon class="inline-block" icon-class="hot" stroke="white" />
{{ t('home.recommended') }}
Expand Down
4 changes: 4 additions & 0 deletions src/components/Header/src/Controls.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,15 @@
<span v-if="$i18n.locale == 'zh-CN'">简体</span>
<span v-if="$i18n.locale == 'zh-TW'">繁體</span>
<span v-if="$i18n.locale == 'en'">En</span>
<span v-if="$i18n.locale == 'es'">Es</span>
</span>
<DropdownMenu>
<DropdownItem name="en" :active="currentLocale === 'en'">
English
</DropdownItem>
<DropdownItem name="es" :active="currentLocale === 'es'">
Español
</DropdownItem>
<DropdownItem name="zh-CN" :active="currentLocale === 'zh-CN'">
简体
</DropdownItem>
Expand Down
18 changes: 18 additions & 0 deletions src/components/MobileMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@
>
{{ route.i18n.en }}
</span>
<span
class="relative z-50"
v-else-if="$i18n.locale === 'es' && route.i18n.es"
>
{{ route.i18n.es }}
</span>
<span class="relative z-50" v-else>{{ route.name }}</span>
</div>
<Dropdown
Expand All @@ -104,6 +110,12 @@
>
{{ route.i18n.en }}
</span>
<span
class="relative z-50"
v-else-if="$i18n.locale === 'es' && route.i18n.es"
>
{{ route.i18n.es }}
</span>
<span class="relative z-50" v-else>{{ route.name }}</span>
<DropdownMenu expand>
<DropdownItem
Expand All @@ -129,6 +141,12 @@
>
{{ sub.i18n.en }}
</span>
<span
class="relative z-50"
v-else-if="$i18n.locale === 'es' && sub.i18n.es"
>
{{ sub.i18n.es }}
</span>
<span class="relative z-50" v-else>{{ sub.name }}</span>
</DropdownItem>
</DropdownMenu>
Expand Down
1 change: 1 addition & 0 deletions src/locales/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"not-found": "Page not found"
},
"home": {
"editor_selection": "EDITOR'S SELECTION",
"recommended": "Feature Articles"
},
"titles": {
Expand Down
92 changes: 92 additions & 0 deletions src/locales/languages/es.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{
"menu": {
"home": "Inicio",
"about": "Acerca de",
"archives": "Archivo",
"categories": "Categorias",
"tags": "Etiquetas",
"post": "Artículos",
"search": "Resultados de la búsqueda",
"message-board": "Centro de mensajes",
"not-found": "Página no encontrada"
},
"home": {
"editor_selection": "SELECCION DEL EDITOR",
"recommended": "Destacados"
},
"titles": {
"articles": "Artículos",
"about": "Acerca de",
"category_list": "Categorias",
"tag_list": "Etiquetas",
"toc": "Tabla de Contenido",
"comment": "Comentarios",
"recent_comment": "Comentarios Recientes"
},
"settings": {
"months": [
"Enero",
"Febrero",
"Marzo",
"Abril",
"Mayo",
"Junio",
"Julio",
"Agosto",
"Septiembre",
"Octubre",
"Noviembre",
"Diciembre"
],
"articles": "Artículos",
"categories": "Categorias",
"tags": "Etiquetas",
"words": "Palabras",
"visitor_count": "Cantidad de visitantes",
"visit_count": "Cantidad de visitas",
"button-all": "Todos",
"paginator": {
"newer": "Pre",
"older": "Siguiente",
"prev": "Anterior",
"next": "Siguiente"
},
"more-tags": "Ver más",
"admin-user": "Dueño",
"shared-on": "compartido en",
"recently-search": "Buscado recientemente:",
"search-result": "Encontrados [total] resultados.",
"no-recent-search": "Sin busquedas recientes.",
"no-search-result": "No se encontraron resultados.",
"cmd-to-select": "para seleccionar",
"cmd-to-navigate": "para navegar",
"cmd-to-close": "para cerrar",
"searched-by": "Búsqueda por",
"tips-back-to-top": "Volver arriba",
"tips-open-menu": "Abrir menú",
"tips-back-to-home": "Volver al inicio",
"tips-open-search": "Abrir buscador",
"default-category": "Artículo",
"default-tag": "ninguno",
"empty-tag": "Sin etiquetas.",
"empty-recent-comments": "Sin comentarios.",
"pinned": "Pin",
"featured": "Hot",
"page-views-value": "Visitas a la Página: ",
"site-running-for": "Tiempo de actividad: ",
"site-running-for-unit": "días",
"links": "Links Amigos",
"links-slogan": "Mejorando con cada blogger",
"links-random-visit": "Visitas random",
"links-apply": "Aplicar a lista de amigos",
"links-badge-personal": "Personal",
"links-badge-personal-desc": "Graba cada paso del camino.",
"links-badge-tech": "Tecnología",
"links-badge-tech-desc": "Blogs de tecnología relacionados.",
"links-badge-designer": "Diseñador",
"links-badge-designer-desc": "Blogs de diseño relacionados.",
"links-badge-vip": "Patrocinadores",
"links-badge-vip-desc": "Patrocinadores recientes",
"notification-random-jump": "Elegir un blogger afortunado al que recurrir."
}
}
1 change: 1 addition & 0 deletions src/locales/languages/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"not-found": "无法找到页面"
},
"home": {
"editor_selection": "EDITOR'S SELECTION",
"recommended": "推荐文章"
},
"titles": {
Expand Down
1 change: 1 addition & 0 deletions src/locales/languages/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"not-found": "無法找到頁面"
},
"home": {
"editor_selection": "EDITOR'S SELECTION",
"recommended": "推薦文章"
},
"titles": {
Expand Down
16 changes: 11 additions & 5 deletions src/models/ThemeConfig.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ export class ThemeMenu implements ObMenu {
i18n: {
'zh-CN': '首页',
'zh-TW': '首頁',
en: 'Home'
en: 'Home',
es: 'Inicio'
}
})
}
Expand All @@ -98,7 +99,8 @@ export class ThemeMenu implements ObMenu {
i18n: {
'zh-CN': '关于',
'zh-TW': '關於',
en: 'About'
en: 'About',
es: 'Acerca de'
}
},
Archives: {
Expand All @@ -107,7 +109,8 @@ export class ThemeMenu implements ObMenu {
i18n: {
'zh-CN': '归档',
'zh-TW': '歸檔',
en: 'Archives'
en: 'Archives',
es: 'Archivos'
}
},
Tags: {
Expand All @@ -116,7 +119,8 @@ export class ThemeMenu implements ObMenu {
i18n: {
'zh-CN': '标签',
'zh-TW': '標簽',
en: 'Tags'
en: 'Tags',
es: 'Etiquetas'
}
},
Links: {
Expand All @@ -125,7 +129,8 @@ export class ThemeMenu implements ObMenu {
i18n: {
'zh-CN': '友情链接',
'zh-TW': '友情鏈接',
en: 'Friend Links'
en: 'Friend Links',
es: 'Links Amigos'
}
}
}
Expand Down Expand Up @@ -157,6 +162,7 @@ export class ThemeMenu implements ObMenu {
}

enum LocalesTypes {
es,
en,
'zh-CN',
'zh-TW'
Expand Down
1 change: 1 addition & 0 deletions src/utils/comments/github-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ export class GithubComment implements RecentComment {
*/
transformTime(lang: Locales): void {
const templates = {
es: 'comentado [TIME]',
en: 'commented [TIME]',
'zh-CN': '[TIME]评论了',
'zh-TW': '[TIME]評論了'
Expand Down
1 change: 1 addition & 0 deletions src/utils/comments/leancloud-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ export class LeanCloudComment implements RecentComment {
*/
transformTime(lang: Locales): void {
const templates = {
es: 'comentado [TIME]',
en: 'commented [TIME]',
'zh-CN': '[TIME]评论了',
'zh-TW': '[TIME]評論了'
Expand Down
8 changes: 8 additions & 0 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ export function formatTime(
lang: 'en'
}
const languages: Record<Locales, { [type: string]: string }> = {
es: {
seconds: 'hace un momento',
minutes: ' minutos',
hours: ' horas',
days: ' días',
months: ' meses',
years: ' años'
},
en: {
seconds: 'just seconds ago',
minutes: ' minutes ago',
Expand Down

0 comments on commit d5e7d7d

Please sign in to comment.