Skip to content

Commit

Permalink
I18n interpolation on fields.route messages (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
wazolab authored Mar 13, 2024
1 parent 5a00067 commit 41e4417
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
7 changes: 3 additions & 4 deletions components/Fields/RoutesField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default defineNuxtComponent({
<div v-else>
<div v-for="(route, activity, index) in routes" :key="activity" class="field">
<div v-if="route.length && index === 0" class="field">
{{ $t('fields.route.length') }} {{ getRouteLength(route.length) }}
{{ $t('fields.route.length', { length: getRouteLength(route.length) }) }}
</div>
<FieldsHeader
:recursion-stack="[...recursionStack, `${activity}`]"
Expand All @@ -82,11 +82,10 @@ export default defineNuxtComponent({
</FieldsHeader>
<ul class="tw-list-disc tw-ml-6">
<li v-if="route.difficulty">
{{ $t('fields.route.difficulty') }}
{{ getRouteDifficulty(activity.toString(), route.difficulty, context) }}
{{ $t('fields.route.difficulty', { difficulty: getRouteDifficulty(activity.toString(), route.difficulty, context) }) }}
</li>
<li v-if="route.duration">
{{ $t('fields.route.duration') }} {{ getRouteDuration(route.duration) }}
{{ $t('fields.route.duration', { duration: getRouteDuration(route.duration) }) }}
</li>
</ul>
</div>
Expand Down
6 changes: 3 additions & 3 deletions locales/en-GB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@ export default defineI18nLocale(() => {
label: 'Stars',
},
route: {
difficulty: 'Difficulty:',
length: 'Distance:',
duration: 'Duration:',
difficulty: 'Difficulty: {difficulty}',
length: 'Distance: {length}',
duration: 'Duration: {duration}',
difficulties: {
easy: 'easy',
normal: 'normal',
Expand Down
6 changes: 3 additions & 3 deletions locales/es-ES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@ export default defineI18nLocale(() => {
label: 'Estrellas',
},
route: {
difficulty: 'Dificultad:',
length: 'Distancia:',
duration: 'Duración:',
difficulty: 'Dificultad: {difficulty}',
length: 'Distancia: {length}',
duration: 'Duración: {duration}',
difficulties: {
easy: 'fácil',
normal: 'normal',
Expand Down
6 changes: 3 additions & 3 deletions locales/fr-FR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ export default defineI18nLocale(() => {
label: 'Étoiles',
},
route: {
difficulty: 'Difficulté :',
length: 'Distance :',
duration: 'Durée :',
difficulty: 'Difficulté : {difficulty}',
length: 'Distance : {length}',
duration: 'Durée : {duration}',
difficulties: {
easy: 'facile',
normal: 'normal',
Expand Down

0 comments on commit 41e4417

Please sign in to comment.