зеркало из https://github.com/github/docs.git
Use zh as language code instead of cn (#33560)
This commit is contained in:
Родитель
aa3b224db2
Коммит
e7983eb8d2
|
@ -41,7 +41,7 @@ jobs:
|
|||
language_dir: translations/pt-BR
|
||||
language_repo: github/docs-internal.pt-br
|
||||
|
||||
- language: cn
|
||||
- language: zh
|
||||
language_dir: translations/zh-CN
|
||||
language_repo: github/docs-internal.zh-cn
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ jobs:
|
|||
script: |
|
||||
// Edit this list for the definitive list of languages
|
||||
// (other than English) we want to index in Elasticsearch.
|
||||
const allNonEnglish = ["ja", "es", "pt", "cn", "ru", "fr", "ko", "de"]
|
||||
const allNonEnglish = ["ja", "es", "pt", "zh", "ru", "fr", "ko", "de"]
|
||||
const allPossible = ["en", ...allNonEnglish]
|
||||
|
||||
if (context.eventName === "workflow_run") {
|
||||
|
@ -114,7 +114,7 @@ jobs:
|
|||
if: ${{ matrix.language != 'en' }}
|
||||
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
|
||||
with:
|
||||
repository: github/docs-internal.${{ fromJSON('{"cn":"zh-cn","es":"es-es","ru":"ru-ru","ja":"ja-jp","pt":"pt-br","de":"de-de","fr":"fr-fr","ko":"ko-kr"}')[matrix.language] }}
|
||||
repository: github/docs-internal.${{ fromJSON('{"zh":"zh-cn","es":"es-es","ru":"ru-ru","ja":"ja-jp","pt":"pt-br","de":"de-de","fr":"fr-fr","ko":"ko-kr"}')[matrix.language] }}
|
||||
token: ${{ secrets.DOCUBOT_READORG_REPO_WORKFLOW_SCOPES }}
|
||||
path: translation
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ jobs:
|
|||
language_dir: translations/pt-BR
|
||||
language_repo: github/docs-internal.pt-br
|
||||
|
||||
- language: cn
|
||||
- language: zh
|
||||
language_dir: translations/zh-CN
|
||||
language_repo: github/docs-internal.zh-cn
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ You can also query our search endpoint directly at:
|
|||
`https://docs.github.com/search?version=<VERSION>&language=<LANGUAGE CODE>&filters=topics:<TOPIC>&query=<QUERY>`
|
||||
|
||||
- The VERSION can be any numbered GitHub Enterprise Server version (e.g., `2.22`, `3.0`), GitHub AE (`ghae`), or the Free pro team plan (`dotcom`).
|
||||
- The LANGUAGE CODE can be: `cn`, `de`, `en`, `es`, `ja`, or `pt`.
|
||||
- The LANGUAGE CODE can be: `zh`, `de`, `en`, `es`, `ja`, or `pt`.
|
||||
- TOPIC can be any topics in [the allowed list of topics](/data/allowed-topics.js). The values in the `topics` attribute are **not** case sensitive, so filtering on `GitHub actions` or `github actions` will return the same result. **Note:** Currently, the topics filter only works for the dotcom version in the English language. We plan to expand this search query to other languages and versions in the future.
|
||||
- Any search QUERY you'd like.
|
||||
|
||||
|
@ -94,15 +94,15 @@ There's a separate search index for each combination of product and language. So
|
|||
|
||||
Index Name | Description
|
||||
---------- | -----------
|
||||
`github-docs-dotcom-cn` | GitHub.com Chinese
|
||||
`github-docs-dotcom-zh` | GitHub.com Chinese
|
||||
`github-docs-dotcom-en` | GitHub.com English
|
||||
`github-docs-dotcom-es` | GitHub.com Spanish
|
||||
`github-docs-dotcom-ja` | GitHub.com Japanese
|
||||
`github-docs-2.18-cn` | GitHub Enterprise 2.18 Chinese
|
||||
`github-docs-2.18-zh` | GitHub Enterprise 2.18 Chinese
|
||||
`github-docs-2.18-en` | GitHub Enterprise 2.18 English
|
||||
`github-docs-2.18-es` | GitHub Enterprise 2.18 Spanish
|
||||
`github-docs-2.18-ja` | GitHub Enterprise 2.18 Japanese
|
||||
`github-docs-2.17-cn` | GitHub Enterprise 2.17 Chinese
|
||||
`github-docs-2.17-zh` | GitHub Enterprise 2.17 Chinese
|
||||
`github-docs-2.17-en` | GitHub Enterprise 2.17 English
|
||||
`github-docs-2.17-es` | GitHub Enterprise 2.17 Spanish
|
||||
`github-docs-2.17-ja` | GitHub Enterprise 2.17 Japanese
|
||||
|
|
|
@ -42,12 +42,12 @@ const languages = {
|
|||
dir: getRoot('en'),
|
||||
wip: false,
|
||||
},
|
||||
cn: {
|
||||
zh: {
|
||||
name: 'Simplified Chinese',
|
||||
nativeName: '简体中文',
|
||||
code: 'cn',
|
||||
code: 'zh',
|
||||
hreflang: 'zh-Hans',
|
||||
redirectPatterns: [/^\/zh-\w{2}/, /^\/zh/],
|
||||
redirectPatterns: [/^\/cn/],
|
||||
dir: getRoot('zh-cn'),
|
||||
wip: false,
|
||||
},
|
||||
|
|
|
@ -27,7 +27,7 @@ export const ymd = /^\d{4}-\d{2}-\d{2}$/
|
|||
export const hasLiquid = /[{{][{%]/
|
||||
export const dataReference = /{% ?data\s(?:early-access\.)?(?:reusables|variables|ui)\..*?%}/gm
|
||||
export const imagePath = /\/?assets\/images\/.*?\.(png|svg|gif|pdf|ico|jpg|jpeg)/gi
|
||||
export const homepagePath = /^\/\w{2}$/ // /en, /ja /cn
|
||||
export const homepagePath = /^\/\w{2}$/ // /en, /ja
|
||||
export const multipleSlashes = /^(\/|\\){2,}/
|
||||
export const assetPaths = /\/(?:javascripts|stylesheets|assets|node_modules|dist|_next)\//
|
||||
export const oldApiPath = /\/v[34]\/(?!guides|overview).+?\/.+/
|
||||
|
|
|
@ -3,7 +3,12 @@ import parser from 'accept-language-parser'
|
|||
|
||||
import { USER_LANGUAGE_COOKIE_NAME } from '../lib/constants.js'
|
||||
|
||||
const chineseRegions = ['CN', 'HK']
|
||||
const chineseRegions = [
|
||||
'CN', // Mainland
|
||||
'HK', // Hong Kong
|
||||
'SG', // Singapore
|
||||
'TW', // Taiwan
|
||||
]
|
||||
|
||||
function translationExists(language) {
|
||||
if (language.code === 'zh') {
|
||||
|
@ -14,7 +19,7 @@ function translationExists(language) {
|
|||
}
|
||||
|
||||
function getLanguageCode(language) {
|
||||
return language.code === 'zh' && chineseRegions.includes(language.region) ? 'cn' : language.code
|
||||
return language.code === 'cn' && chineseRegions.includes(language.region) ? 'zh' : language.code
|
||||
}
|
||||
|
||||
function getUserLanguage(browserLanguages) {
|
||||
|
|
|
@ -22,7 +22,7 @@ const allRedirectPatterns = Object.values(languages)
|
|||
//
|
||||
// Examples:
|
||||
// /jp* -> /ja*
|
||||
// /zh-TW* -> /cn*
|
||||
// /zh-TW* -> /zh*
|
||||
export default function languageCodeRedirects(req, res, next) {
|
||||
// Only in the unlikely event that the `req.path` starts with one of these
|
||||
// prefixes do we bother looking up what the redirect should be.
|
||||
|
|
|
@ -147,7 +147,6 @@ async function createReport() {
|
|||
gitref,
|
||||
datetime: new Date().toJSON(),
|
||||
totalPages: pages.length,
|
||||
// totalErrorPages should be around en: 0, es: 1043, ja: 1004, pt: 995, cn: 1063
|
||||
totalErrorPages: pageErrors.length,
|
||||
pageErrors,
|
||||
// To group errors by message instead
|
||||
|
|
Загрузка…
Ссылка в новой задаче