forked from typeorm/typeorm.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
45 lines (41 loc) · 1.17 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Ready translated locale messages
const messages = {
en: locale_en,
zh_CN: locale_zh_CN
}
// Create VueI18n instance with options
const i18n = new VueI18n({
locale: $cookies.get("locale") || "en", // set locale
fallbackLocale: "en",
messages // set locale messages
});
const router = new VueRouter({
mode: "history",
routes: [{ path: "/:document?/:fragment?", component: DocumentPage }]
});
// Because the documentation previously used "hash" mode in the Router, paths
// starting with a hash will be redirected to prevent breaking old permalinks.
router.beforeEach((to, from, next) => {
if (to.fullPath.substr(0, 3) === "/#/") {
// Remove leading hash and replace following slash with hash.
// Before: https://typeorm.io/#/entities/entity-columns
// After: https://typeorm.io/entities#entity-columns
const path = to.fullPath.substr(3).replace("/", "#");
next(path);
return;
}
next();
});
new Vue({
el: "#app",
i18n,
router: router,
components: {
"main-page": MainPage,
"markdown-reader": MarkdownReader,
},
mounted: function () {
i18n.locale = $cookies.get("locale") || "en";
document.title = this.$t("title");
}
});