@@ -1 +1,2 @@
|
||||
export const PREFERRED_LOCALE_COOKIE_NAME = 'preferredlang'
|
||||
export const TRANSLATIONS_ROOT = process.env.TRANSLATIONS_ROOT || 'translations'
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
// see also languages-schema.js
|
||||
|
||||
import { TRANSLATIONS_ROOT } from './constants.js'
|
||||
import path from 'path'
|
||||
|
||||
const languages = {
|
||||
en: {
|
||||
name: 'English',
|
||||
@@ -13,7 +16,7 @@ const languages = {
|
||||
code: 'cn',
|
||||
hreflang: 'zh-Hans',
|
||||
redirectPatterns: [/^\/zh-\w{2}/, /^\/zh/],
|
||||
dir: 'translations/zh-CN',
|
||||
dir: path.join(TRANSLATIONS_ROOT, 'zh-CN'),
|
||||
},
|
||||
ja: {
|
||||
name: 'Japanese',
|
||||
@@ -21,21 +24,21 @@ const languages = {
|
||||
code: 'ja',
|
||||
hreflang: 'ja',
|
||||
redirectPatterns: [/^\/jp/],
|
||||
dir: 'translations/ja-JP',
|
||||
dir: path.join(TRANSLATIONS_ROOT, 'ja-JP'),
|
||||
},
|
||||
es: {
|
||||
name: 'Spanish',
|
||||
nativeName: 'Español',
|
||||
code: 'es',
|
||||
hreflang: 'es',
|
||||
dir: 'translations/es-ES',
|
||||
dir: path.join(TRANSLATIONS_ROOT, 'es-ES'),
|
||||
},
|
||||
pt: {
|
||||
name: 'Portuguese',
|
||||
nativeName: 'Português do Brasil',
|
||||
code: 'pt',
|
||||
hreflang: 'pt',
|
||||
dir: 'translations/pt-BR',
|
||||
dir: path.join(TRANSLATIONS_ROOT, 'pt-BR'),
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -222,7 +222,7 @@ export async function correctTranslationOrphans(pageList, basePath = null) {
|
||||
|
||||
// Filter out all non-English pages that appear to be excess.
|
||||
// E.g. if an English doc was renamed from `content/foo.md` to
|
||||
// `content/bar.md` what will happen is that `translations/*/content/foo.md`
|
||||
// `content/bar.md` what will happen is that `TRANSLATIONS_ROOT/*/content/foo.md`
|
||||
// will still linger around and we want to remove that even if it was
|
||||
// scooped up from disk.
|
||||
const newPageList = []
|
||||
@@ -263,7 +263,7 @@ export async function correctTranslationOrphans(pageList, basePath = null) {
|
||||
// to create them for this language. But the trick is that we
|
||||
// use the English relative path so it can have something to read.
|
||||
// For example, if we have figured out that
|
||||
// `translations/ja-JP/content/foo.md` doesn't exist, we pretend
|
||||
// `TRANSLATIONS_ROOT/ja-JP/content/foo.md` doesn't exist, we pretend
|
||||
// that we can use `foo.md` and the base path of `content/`.
|
||||
pageLoadPromises.push(
|
||||
Page.init({
|
||||
|
||||
@@ -112,7 +112,10 @@ async function main() {
|
||||
(contents.substring(numIndex, numIndex + 11) === 'GitHub.help' &&
|
||||
contents.charAt(numIndex + 16) === '#') ||
|
||||
(contents.substring(numIndex, numIndex + 16) === 'GitHub.developer' &&
|
||||
contents.charAt(numIndex + 26) === '#')
|
||||
contents.charAt(numIndex + 26) === '#') ||
|
||||
// See internal issue #2180
|
||||
contents.slice(numIndex, numIndex + 'GitHub.help_url}/github/#{'.length) ===
|
||||
'GitHub.help_url}/github/#{'
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user