Skip to content

Commit

Permalink
fix: improve i18n integration + fix hover on NavMenu #124
Browse files Browse the repository at this point in the history
  • Loading branch information
wazolab committed Jan 15, 2024
1 parent e38c89a commit 11e5fcd
Show file tree
Hide file tree
Showing 11 changed files with 576 additions and 582 deletions.
43 changes: 12 additions & 31 deletions components/MainMap/NavMenu.vue
Original file line number Diff line number Diff line change
@@ -1,45 +1,26 @@
<template>
<section
v-if="entries.length + locales.length > 0"
class="tw-relative tw-z-40"
>
<section v-if="entries.length + locales.length > 0" class="tw-relative tw-z-40">
<v-menu offset-y>
<template #activator="{ props }">
<IconButton
:label="$t('navMenu.label')"
class="tw-w-11 tw-h-11 tw-pointer-events-auto"
v-bind="props"
>
<IconButton :label="$t('navMenu.label')" class="tw-w-11 tw-h-11 tw-pointer-events-auto" v-bind="props">
<FontAwesomeIcon icon="cog" class="tw-text-zinc-800" size="lg" />
</IconButton>
</template>

<v-list id="nav-menu-dropdown">
<v-list-item
v-for="entry in entries"
:key="entry.post_id"
class="tw-w-full tw-px-5 tw-py-3 hover:tw-bg-zinc-100"
>
<v-list-item v-for="entry in entries" :key="entry.post_id" class="tw-w-full tw-px-5 tw-py-3 hover:tw-bg-zinc-100">
<v-list-item-title>
<ExternalLink
:href="entry.url"
rel="noopener noreferrer"
target="_blank"
@click="openLink(entry.title, entry.url)"
>
<ExternalLink :href="entry.url" rel="noopener noreferrer" target="_blank"
@click="openLink(entry.title, entry.url)">
{{ entry.title }}
</ExternalLink>
</v-list-item-title>
</v-list-item>
<v-divider v-if="Boolean(entries.length)"></v-divider>
<v-list-item
v-for="locale in locales"
:key="locale.code"
:class="[
'tw-w-full tw-px-5 tw-py-3 hover:tw-bg-zinc-100',
locale.code === $i18n.locale && 'bg-grey-lighten-2',
]"
>
<v-divider v-if="Boolean(entries.length)" />
<v-list-item v-for="locale in locales" :key="locale.code" :class="[
'tw-w-full tw-px-5 tw-py-3 hover:tw-bg-zinc-100',
locale.code === $i18n.locale && 'bg-grey-lighten-2',
]">
<v-list-item-title>
<a href="#" @click.prevent="setLocale(locale.code)">
<VFlag :flag="locale.flag" class="flag" />
Expand Down Expand Up @@ -97,8 +78,8 @@ export default defineNuxtComponent({
},
methods: {
setLocale(locale: string) {
this.$i18n.locale = locale
async setLocale(locale: string) {
await this.$i18n.setLocale(locale)
this.locale = locale
},
openLink(title: string, url: string) {
Expand Down
4 changes: 2 additions & 2 deletions components/UI/VFlag.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import { hasFlag } from 'country-flag-icons'
import { FR, GB, ES } from 'country-flag-icons/string/3x2'
import { FR, US, ES } from 'country-flag-icons/string/3x2'
import { h, ref, watch } from 'vue'
import { defineNuxtComponent } from '#app'
Expand All @@ -20,7 +20,7 @@ export default defineNuxtComponent({
setup(props) {
const svgFlag = ref(null)
const svgs = { FR, GB, ES }
const svgs = { FR, US, ES }
watch(
() => props.flag,
async (newFlag, oldFlag) => {
Expand Down
4 changes: 4 additions & 0 deletions i18n.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default defineI18nConfig(() => ({
fallbackLocale: 'en',
legacy: false,
}))
182 changes: 182 additions & 0 deletions locales/en-US.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
export default defineI18nLocale(() => {
return {
ui: {
close: 'Close',
},
units: {
min: 'min',
hours: 'h',
km: 'km',
},
ponctuation: {
colon: ' :',
},
shareLink: {
copy: 'Copy',
qrcode: 'QR-Code',
},
favorites: {
title: 'Favorites',
list: 'List',
menu_label: 'Favorites menu',
menu_notebook: 'Notebook',
menu_share: 'Share',
menu_clear: 'Clear',
export_pdf: 'PDF Export',
export_csv: 'CSV Export',
share_link: 'Share link of favorites',
notebook: {
title: 'Favorites notebook',
share: 'Share',
print: 'Print',
export: 'Export',
remove: 'Remove',
},
noFavs:
'You do not have any favorite places yet. You can do this by selecting a location on the map, then saving it as a favorite.',
},
mapControls: {
exploreAriaLabel: 'Explore Mode',
exploreButton: 'Explore nearby points of interest',
threeDAriaLabel: 'View the map in 3D',
backgroundAriaLabel: 'Switch the map background',
backgroundButton: 'Switch the map background to "{background}"',
resetBearing: 'Reset bearing to north',
zoomIn: 'Zoom In',
zoomOut: 'Zoom Out',
},
navMenu: {
label: 'Navigation',
},
snack: {
noPoi: {
issue: 'No matching result',
action: 'See more distant places?',
},
noFavorites: {
issue: 'No favorites here.',
action: 'See all favorites?',
},
},
headerMenu: {
logo: 'Logo',
search: 'Search',
searchHint: 'Point of interest, category, address',
selectAll: 'Select all',
unselectAll: 'Unselect all',
filter: 'Filter',
editFilters: 'Edit filters',
categories: 'Categories',
cities: 'Cities',
pois: 'Points of interest',
addresses: 'Addresses',
cartocode: 'Cartocode',
noResult: 'No results',
hideCategory: 'Hide this category',
clearAllCategories: 'Hide all categories',
back: 'Back',
backToMenuFavorites: 'Show menu',
backToMenuExplorer: 'Search by Categories',
backToMenuFavoritesMobile: 'Exit Favorites',
backToMenuExplorerMobile: 'Search by Categories',
disableCategory: 'Remove the category',
},
dateRange: {
from_to: 'From {from} to {to}, {duration} day(s)',
from: 'From {from}',
to: 'Until {to}',
on: 'On {on}',
},
openingHours: {
opened: 'Currently open',
closeAt: 'Closes',
closed: 'Currently closed',
openAt: 'Opens',
next: 'Next',
formatDayAndDayInMonth: "EEE do':'",
variableWeek: 'The hours may vary from week to week.',
},
poiCard: {
details: 'Details',
seeDetail: 'See details',
route: 'Route',
explore: 'Nearby',
favorite: 'Favorite',
favoriteOn: 'Set as favorite',
favoriteOff: 'Remove favorite',
findRoute: 'Find the route to this place',
unactivateExplore: 'Deactivate exploration of the surroundings',
activateExplore: 'Explore nearby points of interest',
zoom: 'Zoom',
backToMap: 'Volver al mapa',
thumbnail: 'Thumbnail',
image: 'Illustration',
},
poiDetails: {
headerDescription: 'Description',
headerDownload: 'Files to download',
lastUpdate: 'Last change',
headerContacts: 'Contact',
shareFacebook: 'Share on Facebook',
shareTwitter: 'Share on Twitter',
shareWhatsApp: 'Share on WhatsApp',
print: 'Print',
link: 'Share link',
qrcode: 'Share with QR-Code',
poweredBy: 'Powered by',
mapillaryExplore: 'Explore on Mapillary',
informations: 'Informations',
downloadGPX: 'The route (GPS track) in GPX format',
downloadPDF: 'The complete card in PDF format',
routes: {
waypoints: 'Waypoints',
pois: 'Point of Interests',
},
},
poisTable: {
empty: 'Empty List',
details: 'Details',
downloadCsv: 'Download in CSV',
downloadGeojson: 'Download in GeoJSON',
showOnMap: 'Show on Map',
},
categorySelector: {
placeholderSelect: 'Select a category',
placeholderAdd: 'RSearch for a category to add',
search: 'Search into the list',
},
dateFilter: {
today: 'Today',
tomorrow: 'Tomorrow',
thisWeekend: 'Coming week-end',
nextWeek: 'Next 7 days',
nextMonth: 'Next 30 days',
},
listFilter: {
label: 'Search or add a value',
},
fields: {
phone: {
callNumber: 'Call this number',
},
stars: {
label: 'Stars',
},
route: {
difficulty: 'Difficulty:',
length: 'Distance:',
duration: 'Duration:',
difficulties: {
easy: 'easy',
normal: 'normal',
hard: 'hard',
},
},
},
cookiesConsent: {
accept: 'Agree',
details: 'More information',
decline: 'Decline',
}
}
})
Loading

0 comments on commit 11e5fcd

Please sign in to comment.