Skip to content

Commit 1175279

Browse files
committed
i18n: fallback to en
1 parent e79cd83 commit 1175279

38 files changed

Lines changed: 61 additions & 698 deletions

cache/tutorialTree.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

cache/tutorialViewStorage.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

cache/webpack.versions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"footer":"/pack/footer.js?ac0d9ec6312de889f54c","head":"/pack/head.js?ac0d9ec6312de889f54c","styles":["/pack/styles.js?ac0d9ec6312de889f54c","/pack/styles.css?cb58fe2ae21d9517d8f37e774560d011"],"tutorial":"/pack/tutorial.js?ac0d9ec6312de889f54c"}
1+
{"footer":"/pack/footer.js?f63f5c82f3f1f0cc1dd1","head":"/pack/head.js?f63f5c82f3f1f0cc1dd1","styles":["/pack/styles.js?f63f5c82f3f1f0cc1dd1","/pack/styles.css?cb58fe2ae21d9517d8f37e774560d011"],"tutorial":"/pack/tutorial.js?f63f5c82f3f1f0cc1dd1"}

handlers/tutorial/controller/article.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ exports.get = async function(ctx, next) {
8484
}
8585

8686
section2.links.push({
87-
title: t('site.comments'),
87+
title: t('config.site.comments'),
8888
url: '#comments'
8989
});
9090

@@ -235,7 +235,7 @@ async function renderArticle(ctx) {
235235
parent = a.parent;
236236
}
237237
path.push({
238-
title: t('site.tutorial'),
238+
title: t('config.site.tutorial'),
239239
url: '/'
240240
});
241241
path = path.reverse();

handlers/tutorial/controller/frontpage.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ const ArticleRenderer = require('../renderer/articleRenderer');
88
const localStorage = require('localStorage').instance();
99
const t = require('i18n');
1010

11-
const LANG = require('config').lang;
12-
13-
t.requirePhrase('tutorial.frontpage', require('../locales/frontpage/' + LANG + '.yml'));
11+
t.requirePhrase('tutorial', 'frontpage');
1412

1513

1614
exports.get = async function (ctx, next) {

handlers/tutorial/controller/map.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ const makeAnchor = require('textUtil/makeAnchor');
1010

1111
const t = require('i18n');
1212

13-
const LANG = require('config').lang;
14-
15-
t.requirePhrase('tutorial.map', require('../locales/map/' + LANG + '.yml'));
13+
t.requirePhrase('tutorial', 'map');
1614

1715
exports.get = async function(ctx) {
1816

@@ -29,7 +27,7 @@ exports.get = async function(ctx) {
2927
tutorialTree.bySlug(tutorialTree.tree[1]),
3028
{
3129
getUrl() {},
32-
title: t('site.additional_articles'),
30+
title: t('config.site.additional_articles'),
3331
children: tutorialTree.tree.slice(2)
3432
}
3533
]

handlers/tutorial/controller/task.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ exports.get = async function(ctx, next) {
3434
parentSlug = parent.parent;
3535
}
3636
breadcrumbs.push({
37-
title: t('site.tutorial'),
37+
title: t('config.site.tutorial'),
3838
url: '/'
3939
});
4040

handlers/tutorial/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
const mountHandlerMiddleware = require('lib/mountHandlerMiddleware');
44

55
const t = require('i18n');
6-
const LANG = require('config').lang;
76

8-
t.requirePhrase('tutorial.article', require('./locales/article/' + LANG + '.yml'));
9-
t.requirePhrase('tutorial.task', require('./locales/task/' + LANG + '.yml'));
7+
t.requirePhrase('tutorial', 'article');
8+
t.requirePhrase('tutorial', 'task');
109

1110

1211
exports.TutorialViewStorage = require('./models/tutorialViewStorage');

handlers/tutorial/lib/resolveTutorialLinks.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@ const TutorialTree = require('../models/tutorialTree');
1414
const Token = require('markit').Token;
1515
const t = require('i18n');
1616
const url = require('url');
17-
const LANG = require('config').lang;
1817
const tokenUtils = require('markit').tokenUtils;
1918

20-
t.requirePhrase('tutorial.article', require('../locales/article/' + LANG + '.yml'));
21-
t.requirePhrase('tutorial.task', require('../locales/task/' + LANG + '.yml'));
19+
t.requirePhrase('tutorial', 'article');
20+
t.requirePhrase('tutorial', 'task');
2221

2322

2423
module.exports = async function (tokens) {

handlers/tutorial/lib/tutorialImporter.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,9 @@ const stripYamlMetadata = require('markit').stripYamlMetadata;
2121
const mime = require('mime');
2222
const stripIndents = require('textUtil/stripIndents');
2323

24-
2524
const t = require('i18n');
2625

27-
const LANG = require('config').lang;
28-
29-
t.requirePhrase('tutorial.importer', require('../locales/importer/' + LANG + '.yml'));
26+
t.requirePhrase('tutorial', 'importer');
3027

3128
module.exports = class TutorialImporter {
3229
constructor(options) {

0 commit comments

Comments
 (0)