chore: update to new content of `electron/i18n` (#5276)
In https://github.com/electron/i18n/pull/1811 there are changes to what properties the `i18n` package export that would break the website. More notably `electronStableVersion` does not exist anymore. This PR calculates that property and keeps exposing it in the handlebars context.
This commit is contained in:
Родитель
ef68590a8d
Коммит
e5f3c7d980
|
@ -1,7 +1,8 @@
|
||||||
const i18n = require('lib/i18n')
|
const i18n = require('lib/i18n')
|
||||||
const electronReleases = require('electron-releases')
|
const electronReleases = require('electron-releases')
|
||||||
|
const electronLatestStableVersion = i18n.electronLatestStableTag.slice(1)
|
||||||
const { deps } = electronReleases.find(
|
const { deps } = electronReleases.find(
|
||||||
(release) => release.version === i18n.electronLatestStableVersion
|
(release) => release.version === electronLatestStableVersion
|
||||||
)
|
)
|
||||||
const { getLanguageNativeName } = require('locale-code')
|
const { getLanguageNativeName } = require('locale-code')
|
||||||
const rtlDetect = require('rtl-detect')
|
const rtlDetect = require('rtl-detect')
|
||||||
|
@ -41,13 +42,8 @@ module.exports = function contextBuilder(req, res, next) {
|
||||||
}
|
}
|
||||||
|
|
||||||
req.context = {
|
req.context = {
|
||||||
electronLatestStableVersion: i18n.electronLatestStableVersion,
|
electronLatestStableVersion,
|
||||||
electronLatestStableTag: i18n.electronLatestStableTag,
|
electronLatestStableTag: i18n.electronLatestStableTag,
|
||||||
electronMasterBranchCommit: i18n.electronMasterBranchCommit,
|
|
||||||
electronMasterBranchCommitShort: i18n.electronMasterBranchCommit.slice(
|
|
||||||
0,
|
|
||||||
6
|
|
||||||
),
|
|
||||||
deps: deps,
|
deps: deps,
|
||||||
releases: new Releases(electronReleases),
|
releases: new Releases(electronReleases),
|
||||||
currentLocale: req.language,
|
currentLocale: req.language,
|
||||||
|
|
|
@ -25,11 +25,7 @@
|
||||||
{{else}}
|
{{else}}
|
||||||
<a href="{{doc.href}}/history">
|
<a href="{{doc.href}}/history">
|
||||||
<span class="docs-version">
|
<span class="docs-version">
|
||||||
{{#if doc.isApiDoc}}
|
<span>v{{electronLatestStableVersion}}</span>
|
||||||
{{electronLatestStableTag}}
|
|
||||||
{{else}}
|
|
||||||
<span>electron@master ({{electronMasterBranchCommitShort}})</span>
|
|
||||||
{{/if}}
|
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче