Skip to content

Commit

Permalink
feat: translate all texts
Browse files Browse the repository at this point in the history
  • Loading branch information
pablosirera committed Jun 27, 2020
1 parent 2ae8f20 commit 6a6fe68
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 33 deletions.
2 changes: 1 addition & 1 deletion components/Logo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<img
class="w-40 rounded-full nuxt-logo"
src="https://res.cloudinary.com/de5xzoviz/image/upload/c_scale,q_58,w_640/v1592684920/IMG_6225_brctd5.jpg"
alt="My photo"
:alt="$t('general.altLogo')"
/>
</template>

Expand Down
46 changes: 15 additions & 31 deletions components/ui/BlogCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,42 +38,26 @@ export default {
computed: {
monthNames() {
return [
'enero',
'febrero',
'marzo',
'abril',
'mayo',
'junio',
'julio',
'agosto',
'septiembre',
'octubre',
'noviembre',
'diciembre',
this.$t('months.january'),
this.$t('months.february'),
this.$t('months.march'),
this.$t('months.april'),
this.$t('months.may'),
this.$t('months.june'),
this.$t('months.july'),
this.$t('months.august'),
this.$t('months.september'),
this.$t('months.october'),
this.$t('months.november'),
this.$t('months.december'),
]
// TODO: integrate translations
// return [
// this.$t('months.january'),
// this.$t('months.february'),
// this.$t('months.march'),
// this.$t('months.april'),
// this.$t('months.may'),
// this.$t('months.june'),
// this.$t('months.july'),
// this.$t('months.august'),
// this.$t('months.september'),
// this.$t('months.october'),
// this.$t('months.november'),
// this.$t('months.december'),
// ]
},
},
methods: {
getTimeToReadText(timeToRead) {
// TODO: integrate translations
// const keyTranslateText = timeToRead > 1 ? 'minutes' : 'minute'
// const translateText = this.$i18n.t(`posts.${keyTranslateText}`)
return `${timeToRead} minutos`
const keyTranslateText = timeToRead > 1 ? 2 : 1
const translateText = this.$i18n.tc('posts.minute', keyTranslateText)
return `${timeToRead} ${translateText}`
},
getDate(date) {
const newDate = new Date(date)
Expand Down
20 changes: 20 additions & 0 deletions locales/es.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
{
"general": {
"altLogo": "Pablo Sirera, desarrollador web frontend | Javascript, Vue y Nuxt"
},
"months": {
"april": "Abril",
"august": "Agosto",
"december": "Diciembre",
"february": "Febrero",
"january": "Enero",
"july": "Julio",
"june": "Junio",
"march": "Marzo",
"may": "Mayo",
"november": "Noviembre",
"october": "Octubre",
"september": "Septiembre"
},
"posts": {
"minute": "minuto | minutos"
},
"projects": {
"title": "Mis projectos"
}
Expand Down
1 change: 0 additions & 1 deletion pages/blog/index.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<template>
<div>
// TODO: translate this title
<h1 class="title">Blog</h1>
<div class="flex flex-col m-auto pt-8">
<BlogCard
Expand Down

0 comments on commit 6a6fe68

Please sign in to comment.