2023-02-07 17:44:23 +01:00
|
|
|
export default async (context, locale) => {
|
|
|
|
try {
|
|
|
|
if (process.server) {
|
|
|
|
return context.$axios.$get(`locale/${locale}`)
|
|
|
|
} else {
|
2023-02-07 17:44:44 +01:00
|
|
|
// cannot use $axios here as plugins have not yet been loaded
|
2023-02-07 17:44:23 +01:00
|
|
|
return fetch(`${window.location.origin}/api/locale/${locale}`).then(ret => ret.json())
|
|
|
|
}
|
|
|
|
} catch (e) {
|
|
|
|
console.error(`Error loading locale ${locale}`, e)
|
|
|
|
}
|
|
|
|
|
|
|
|
return localeMessages
|
2023-06-17 09:30:44 +02:00
|
|
|
}
|