Add a language switcher with English, Italian, Spanish and French
The interface is translated through @nuxtjs/i18n: strings live in i18n/locales/*.json, routes are prefixed except for the default English, and useLocaleHead emits the lang attribute, the hreflang alternates and og:locale. The switcher is a native select rather than a custom dropdown: keyboard support, the platform picker on mobile and correct labelling come for free. Article content stays single-language — this translates the site chrome only.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/** Human-readable date for display; returns an empty string when unset. */
|
||||
export function formatDate(value: string | null | undefined): string {
|
||||
export function formatDate(value: string | null | undefined, locale = 'en-GB'): string {
|
||||
if (!value) return ''
|
||||
return new Intl.DateTimeFormat('en-GB', { dateStyle: 'long' }).format(new Date(value))
|
||||
return new Intl.DateTimeFormat(locale, { dateStyle: 'long' }).format(new Date(value))
|
||||
}
|
||||
|
||||
/** Machine-readable date for the `datetime` attribute and structured data. */
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
/** Name of the blog, used in the header, the page titles and the footer. */
|
||||
/** Name of the blog. Not translated: it is the brand. */
|
||||
export const SITE_NAME = 'CorralitoComing'
|
||||
|
||||
/** One-line description, used as the home page meta description. */
|
||||
export const SITE_DESCRIPTION = 'Articles, guides and analysis.'
|
||||
|
||||
/** Public contact address, shown in the footer. */
|
||||
export const SITE_EMAIL = 'corralitocoming@gmail.com'
|
||||
|
||||
Reference in New Issue
Block a user