chore: update doc links to localized versions
This commit is contained in:
Родитель
6bff1591ad
Коммит
8d3206c67b
16
server.js
16
server.js
|
@ -88,6 +88,7 @@ app.use(
|
|||
// Helper to generate the redirects to the right document in the new docs paths
|
||||
hbs.registerHelper('new-docs', (currentPage) => {
|
||||
// This particular page is the root for the docs in the new site
|
||||
|
||||
if (!currentPage || currentPage.endsWith('tutorial/introduction')) {
|
||||
return '/docs/latest/'
|
||||
} else {
|
||||
|
@ -95,6 +96,21 @@ hbs.registerHelper('new-docs', (currentPage) => {
|
|||
}
|
||||
})
|
||||
|
||||
/**
|
||||
* This helper "transforms" a locale in the form of xx-XX to the 2 char code
|
||||
* used by Crowdin.
|
||||
*/
|
||||
hbs.registerHelper('to2CharLocale', (locale) => {
|
||||
// Because of the current supported languages, we do not have any edge cases
|
||||
const [language] = locale.toLowerCase().split('-')
|
||||
|
||||
if (locale === 'en') {
|
||||
return ''
|
||||
} else {
|
||||
return language
|
||||
}
|
||||
})
|
||||
|
||||
if (isProduction) {
|
||||
const jsManifest = require(path.join(
|
||||
__dirname,
|
||||
|
|
|
@ -108,7 +108,7 @@
|
|||
{{#eq currentLocale "en-US"}}
|
||||
<a class="hero-link" href="/docs/latest/api/auto-updater/">
|
||||
{{else}}
|
||||
<a class="hero-link" href="/docs/api/auto-updater/">
|
||||
<a class="hero-link" href="/{{ to2CharLocale currentLocale }}/docs/api/auto-updater/">
|
||||
{{/eq}}
|
||||
<span class="octicon hero-octicon octicon-squirrel" aria-hidden="true"></span>
|
||||
{{{localized.benefits.automatic_updates}}}
|
||||
|
@ -118,7 +118,7 @@
|
|||
{{#eq currentLocale "en-US"}}
|
||||
<a class="hero-link" href="/docs/latest/api/menu">
|
||||
{{else}}
|
||||
<a class="hero-link" href="/docs/api/menu">
|
||||
<a class="hero-link" href="/{{ to2CharLocale currentLocale }}/docs/api/menu">
|
||||
{{/eq}}
|
||||
<span class="octicon hero-octicon octicon-device-desktop" aria-hidden="true"></span>
|
||||
{{{localized.benefits.native_menus_and_notifications}}}
|
||||
|
@ -128,7 +128,7 @@
|
|||
{{#eq currentLocale "en-US"}}
|
||||
<a class="hero-link" href="/docs/latest/api/crash-reporter">
|
||||
{{else}}
|
||||
<a class="hero-link" href="/docs/api/crash-reporter">
|
||||
<a class="hero-link" href="/{{ to2CharLocale currentLocale }}/docs/api/crash-reporter">
|
||||
{{/eq}}
|
||||
<span class="octicon hero-octicon octicon-bug" style="padding-left:2px" aria-hidden="true"></span>
|
||||
{{{localized.benefits.crash_reporting}}}
|
||||
|
@ -138,7 +138,7 @@
|
|||
{{#eq currentLocale "en-US"}}
|
||||
<a class="hero-link" href="/docs/latest/api/content-tracing">
|
||||
{{else}}
|
||||
<a class="hero-link" href="/docs/api/content-tracing">
|
||||
<a class="hero-link" href="/{{ to2CharLocale currentLocale }}/docs/api/content-tracing">
|
||||
{{/eq}}
|
||||
<span class="octicon hero-octicon octicon-tools" aria-hidden="true"></span>
|
||||
{{{localized.benefits.debugging_and_profiling}}}
|
||||
|
@ -148,7 +148,7 @@
|
|||
{{#eq currentLocale "en-US"}}
|
||||
<a class="hero-link" href="/docs/api/auto-updater/#windows">
|
||||
{{else}}
|
||||
<a class="hero-link" href="/docs/api/auto-updater/#windows">
|
||||
<a class="hero-link" href="/{{ to2CharLocale currentLocale }}/docs/api/auto-updater/#windows">
|
||||
{{/eq}}
|
||||
<span class="octicon hero-octicon octicon-gift" style="padding-right:2px" aria-hidden="true"></span>
|
||||
{{{localized.benefits.windows_installers}}}
|
||||
|
|
|
@ -15,10 +15,14 @@
|
|||
{{#eq currentLocale "en-US"}}
|
||||
<li class="footer-nav-item"><a href="/docs/latest">{{localized.nav.docs}}</a></li>
|
||||
{{else}}
|
||||
<li class="footer-nav-item"><a href="/docs">{{localized.nav.docs}}</a></li>
|
||||
<li class="footer-nav-item"><a href="/{{ to2CharLocale currentLocale }}/docs/latest">{{localized.nav.docs}}</a></li>
|
||||
{{/eq}}
|
||||
<li class="footer-nav-item"><a href="/releases/stable">{{localized.nav.releases}}</a></li>
|
||||
{{#eq currentLocale "en-US"}}
|
||||
<li class="footer-nav-item"><a href="/blog">{{localized.nav.blog}}</a></li>
|
||||
{{else}}
|
||||
<li class="footer-nav-item"><a href="/{{ to2CharLocale currentLocale }}/blog">{{localized.nav.blog}}</a></li>
|
||||
{{/eq}}
|
||||
<li class="footer-nav-item"><a href="/apps">{{localized.nav.apps}}</a></li>
|
||||
<li class="footer-nav-item"><a href="/governance">{{localized.nav.governance}}</a></li>
|
||||
<li class="footer-nav-item"><a href="/community">{{localized.nav.community}}</a></li>
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
{{#eq currentLocale "en-US"}}
|
||||
<a class="site-header-nav-item" href="/docs/latest">{{localized.nav.docs}}</a>
|
||||
{{else}}
|
||||
<a class="site-header-nav-item" href="/docs">{{localized.nav.docs}}</a>
|
||||
<a class="site-header-nav-item" href="/{{ to2CharLocale currentLocale }}/docs/latest">{{localized.nav.docs}}</a>
|
||||
{{/eq}}
|
||||
<a class="site-header-nav-item" data-href-match="/releases" href="/releases/stable">{{localized.nav.releases}}</a>
|
||||
<a class="site-header-nav-item" href="/blog">{{localized.nav.blog}}</a>
|
||||
|
|
Загрузка…
Ссылка в новой задаче