Skip to content

Commit

Permalink
i18next-vue example with Suspense usage
Browse files Browse the repository at this point in the history
  • Loading branch information
adrai committed May 13, 2022
1 parent 888b988 commit 9b6e3ce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
9 changes: 5 additions & 4 deletions example/i18next-vue/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
</template>

<script>
import { i18nextPromise } from './i18n.js'
import TranslationShowCase from './components/TranslationShowCase.vue'
export default {
Expand All @@ -13,10 +14,10 @@ export default {
},
// used in combination with Suspense.
// useful when translations are not in-memory...
// async setup() {
// await i18nextPromise;
// return {};
// }
async setup() {
await i18nextPromise;
return {};
}
}
</script>

Expand Down
5 changes: 3 additions & 2 deletions example/i18next-vue/src/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import i18next from 'i18next'
import i18nextHttpBackend from 'i18next-http-backend'
import LanguageDetector from 'i18next-browser-languagedetector'

export default function (app) {
i18next
export const i18nextPromise = i18next
.use(LanguageDetector)
.use(i18nextHttpBackend)
.init({
Expand All @@ -14,5 +13,7 @@ export default function (app) {
loadPath: './locales/{{lng}}/{{ns}}.json'
}
});

export default function (app) {
app.use(I18NextVue, { i18next });
}

0 comments on commit 9b6e3ce

Please sign in to comment.