Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions examples/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,19 @@ import VueFinder from '../src/index.js'

const app = createApp(App);

const supportedLocales = Object.fromEntries(
Object.entries(import.meta.glob(["../src/locales/*.js"])).map(([path, locale]) => {
return [path.slice(path.lastIndexOf("/") + 1, -3), locale];
})
);

app.use(VueFinder,
{
// you can set the default locale, if you don't set the locale key, it will be the first locale in the i18n object (en in this case)
// if if you set a locale prop of the vuefinder elements, it will override this default locale
locale: 'en',
i18n: {
...supportedLocales,
ar: async () => await import ("../src/locales/ar.js"),
en: async () => await import ("../src/locales/en.js"),
fr: async () => await import ("../src/locales/fr.js"),
Expand All @@ -22,8 +29,8 @@ app.use(VueFinder,
sv: async () => await import ("../src/locales/sv.js"),
tr: async () => await import ("../src/locales/tr.js"),
nl: async () => await import ("../src/locales/nl.js"),
zhCN: async () => await import ("../src/locales/zhCN.js"),
zhTW: async () => await import ("../src/locales/zhTW.js"),
zh_CN: async () => await import ("../src/locales/zh_CN.js"),
zh_TW: async () => await import ("../src/locales/zh_TW.js"),
}
}
)
Expand Down
Loading