forked from github.com/GenderDysphoria.fyi
Adding more internationalization support
This commit is contained in:
@@ -12,7 +12,7 @@ const slugify = require('./lib/slugify');
|
||||
const { stripHtml } = require('string-strip-html');
|
||||
|
||||
const markdownIt = require('markdown-it');
|
||||
|
||||
const i18n = require('../lang');
|
||||
|
||||
|
||||
const markdownEngines = {
|
||||
@@ -144,6 +144,7 @@ class Injectables {
|
||||
this.prod = prod;
|
||||
this.revManifest = revManifest;
|
||||
this.injections = {};
|
||||
this.languages = {};
|
||||
}
|
||||
|
||||
_parsePath (tpath, local, type) {
|
||||
@@ -182,6 +183,7 @@ class Injectables {
|
||||
icon: this.icon(),
|
||||
prod: this.production(),
|
||||
rev: this.rev(),
|
||||
lang: this.lang(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -268,4 +270,12 @@ class Injectables {
|
||||
};
|
||||
}
|
||||
|
||||
lang () {
|
||||
return function (key, ...args) {
|
||||
const { resolve: rval } = args.pop();
|
||||
const lang = rval('@root.this.page.lang').split('-')[0];
|
||||
return i18n(lang, key, ...args);
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user