mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
c9d0670362
* examples/with-i18next: create folder and initial settings * examples/with-i18next:abstract url and object keys - finish readme * examples/with-i18next: next@beta is not actually necessary * examples/with-it18next: fix standardjs eslint warnings * examples/with-i18next: review updates
14 lines
266 B
JavaScript
14 lines
266 B
JavaScript
/* global fetch */
|
|
import 'isomorphic-fetch'
|
|
|
|
export async function getTranslation (lang, file, baseUrl) {
|
|
const response = await fetch(`${baseUrl}${lang}/${file}.json`)
|
|
const json = await response.json()
|
|
|
|
return {
|
|
[lang]: {
|
|
[file]: json
|
|
}
|
|
}
|
|
}
|