Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/constants.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export const PREFERRED_LOCALE_COOKIE_NAME = 'preferredlang'
export const TRANSLATIONS_ROOT = process.env.TRANSLATIONS_ROOT || 'translations'
11 changes: 7 additions & 4 deletions lib/languages.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// see also languages-schema.js

import { TRANSLATIONS_ROOT } from './constants.js'
import path from 'path'

const languages = {
en: {
name: 'English',
Expand All @@ -13,29 +16,29 @@ 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',
nativeName: '日本語',
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'),
},
}

Expand Down
4 changes: 2 additions & 2 deletions lib/page-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down Expand Up @@ -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({
Expand Down
5 changes: 4 additions & 1 deletion script/check-github-github-links.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down