mirror of
https://github.com/paricafe/misskey.git
synced 2024-11-28 11:56:44 -06:00
.yaml -> .yml
This commit is contained in:
parent
bb59dd6e11
commit
cf1e320cfa
1 changed files with 18 additions and 16 deletions
|
@ -11,8 +11,8 @@ import version from './src/version';
|
||||||
const constants = require('./src/const.json');
|
const constants = require('./src/const.json');
|
||||||
|
|
||||||
const languages = {
|
const languages = {
|
||||||
'en': yaml.safeLoad(fs.readFileSync('./locales/en.yaml', 'utf-8')),
|
'en': yaml.safeLoad(fs.readFileSync('./locales/en.yml', 'utf-8')),
|
||||||
'ja': yaml.safeLoad(fs.readFileSync('./locales/ja.yaml', 'utf-8'))
|
'ja': yaml.safeLoad(fs.readFileSync('./locales/ja.yml', 'utf-8'))
|
||||||
};
|
};
|
||||||
|
|
||||||
const env = process.env.NODE_ENV;
|
const env = process.env.NODE_ENV;
|
||||||
|
@ -35,7 +35,8 @@ module.exports = (Object as any).entries(languages).map(([lang, locale]) => {
|
||||||
exclude: /node_modules/,
|
exclude: /node_modules/,
|
||||||
loader: StringReplacePlugin.replace({
|
loader: StringReplacePlugin.replace({
|
||||||
replacements: [
|
replacements: [
|
||||||
{ pattern: /%i18n:(.+?)%/g, replacement: (_, key) => {
|
{
|
||||||
|
pattern: /%i18n:(.+?)%/g, replacement: (_, key) => {
|
||||||
let text = locale;
|
let text = locale;
|
||||||
const error = key.split('.').some(k => {
|
const error = key.split('.').some(k => {
|
||||||
if (text.hasOwnProperty(k)) {
|
if (text.hasOwnProperty(k)) {
|
||||||
|
@ -51,7 +52,8 @@ module.exports = (Object as any).entries(languages).map(([lang, locale]) => {
|
||||||
} else {
|
} else {
|
||||||
return text.replace(/'/g, '\\\'').replace(/"/g, '\\"');
|
return text.replace(/'/g, '\\\'').replace(/"/g, '\\"');
|
||||||
}
|
}
|
||||||
} }
|
}
|
||||||
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue