diff options
author | Zero~Informatique | 2019-12-20 17:47:04 +0100 |
---|---|---|
committer | Zero~Informatique | 2019-12-20 23:22:56 +0100 |
commit | 7ae68f079ddfb74c9a1b17c4f30dfe4c258d4a9f (patch) | |
tree | cb5e30534d9e564c311d626bba7e8d9ec0ea0f60 /viewer/src/plugins | |
parent | c9264b0a0a7e1cb92ef7d9a391cee2c94376cff3 (diff) | |
download | ldgallery-7ae68f079ddfb74c9a1b17c4f30dfe4c258d4a9f.tar.gz |
Viewer project foundations
Diffstat (limited to 'viewer/src/plugins')
-rw-r--r-- | viewer/src/plugins/buefy.ts | 9 | ||||
-rw-r--r-- | viewer/src/plugins/fontawesome.js | 9 | ||||
-rw-r--r-- | viewer/src/plugins/i18n.ts | 23 |
3 files changed, 41 insertions, 0 deletions
diff --git a/viewer/src/plugins/buefy.ts b/viewer/src/plugins/buefy.ts new file mode 100644 index 0000000..a880cee --- /dev/null +++ b/viewer/src/plugins/buefy.ts | |||
@@ -0,0 +1,9 @@ | |||
1 | import Vue from "vue"; | ||
2 | |||
3 | import Buefy from "buefy"; | ||
4 | import "@/assets/scss/buefy.scss"; | ||
5 | |||
6 | Vue.use(Buefy, { | ||
7 | defaultIconComponent: 'fa-icon', | ||
8 | defaultIconPack: 'fas', | ||
9 | }); | ||
diff --git a/viewer/src/plugins/fontawesome.js b/viewer/src/plugins/fontawesome.js new file mode 100644 index 0000000..9bf4dba --- /dev/null +++ b/viewer/src/plugins/fontawesome.js | |||
@@ -0,0 +1,9 @@ | |||
1 | import Vue from "vue"; | ||
2 | |||
3 | import { library } from "@fortawesome/fontawesome-svg-core"; | ||
4 | import { faExpandArrowsAlt } from "@fortawesome/free-solid-svg-icons"; | ||
5 | import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; | ||
6 | |||
7 | library.add(faExpandArrowsAlt); | ||
8 | |||
9 | Vue.component("fa-icon", FontAwesomeIcon); | ||
diff --git a/viewer/src/plugins/i18n.ts b/viewer/src/plugins/i18n.ts new file mode 100644 index 0000000..da2cd87 --- /dev/null +++ b/viewer/src/plugins/i18n.ts | |||
@@ -0,0 +1,23 @@ | |||
1 | import Vue from "vue"; | ||
2 | import VueI18n, { LocaleMessages } from "vue-i18n"; | ||
3 | |||
4 | Vue.use(VueI18n); | ||
5 | |||
6 | function loadLocaleMessages(): LocaleMessages { | ||
7 | const locales = require.context("@/locales", true, /[A-Za-z0-9-_,\s]+\.json$/i); | ||
8 | const messages: LocaleMessages = {}; | ||
9 | locales.keys().forEach(key => { | ||
10 | const matched = key.match(/([A-Za-z0-9-_]+)\./i); | ||
11 | if (matched && matched.length > 1) { | ||
12 | const locale = matched[1]; | ||
13 | messages[locale] = locales(key); | ||
14 | } | ||
15 | }); | ||
16 | return messages; | ||
17 | } | ||
18 | |||
19 | export default new VueI18n({ | ||
20 | locale: process.env.VUE_APP_I18N_LOCALE || "en", | ||
21 | fallbackLocale: process.env.VUE_APP_I18N_FALLBACK_LOCALE || "en", | ||
22 | messages: loadLocaleMessages(), | ||
23 | }); | ||