1
0
mirror of synced 2025-12-19 09:57:42 -05:00

Create languages src directory (#41661)

This commit is contained in:
Kevin Heis
2023-08-30 10:24:59 -07:00
committed by GitHub
parent df293570e7
commit 9bf3fc185a
108 changed files with 153 additions and 134 deletions

View File

@@ -46,4 +46,4 @@ jobs:
if: ${{ !inputs.nuke_all }}
env:
LANGUAGES: ${{ inputs.languages }}
run: .github/actions-scripts/purge-fastly-edge-cache-per-language.js
run: src/languages/scripts/purge-fastly-edge-cache-per-language.js

View File

@@ -34,9 +34,9 @@ jobs:
id: set-matrix
with:
script: |
// We only want to run the 'translations' suite when we know
// We only want to run the 'languages' suite when we know
// we're on the private docs-internal repo because only that
// one has ability to clone the remote (private) translations
// one has ability to clone the remote (private) languages
// repos.
// You can run multiple paths per suite as space-separated in `path`.
// Note that *if you add* to this, remember to also add that
@@ -64,7 +64,7 @@ jobs:
{ name: 'search', path: 'src/search/tests', },
{ name: 'shielding', path: 'src/shielding/tests', },
context.payload.repository.full_name === 'github/docs-internal' &&
{ name: 'translations', path: 'tests/translations', },
{ name: 'languages', path: 'src/languages/tests', },
{ name: 'unit', path: 'tests/unit', },
// { name: 'tools', path: 'src/tools/tests', }
{ name: 'webhooks', path: 'src/webhooks/tests', },
@@ -88,7 +88,7 @@ jobs:
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
- uses: ./.github/actions/setup-elasticsearch
if: ${{ matrix.name == 'search' || matrix.name == 'translations' }}
if: ${{ matrix.name == 'search' || matrix.name == 'languages' }}
- uses: ./.github/actions/node-npm-setup
@@ -117,7 +117,7 @@ jobs:
tests/fixtures/data
- name: Clone all translations
if: ${{ matrix.name == 'translations' }}
if: ${{ matrix.name == 'languages' }}
uses: ./.github/actions/clone-translations
with:
token: ${{ secrets.DOCS_BOT_PAT_READPUBLICKEY }}
@@ -169,7 +169,7 @@ jobs:
- name: Index fixtures into the local Elasticsearch
# For the sake of saving time, only run this step if the group
# is one that will run tests against an Elasticsearch on localhost.
if: ${{ matrix.name == 'search' || matrix.name == 'translations' }}
if: ${{ matrix.name == 'search' || matrix.name == 'languages' }}
run: npm run index-test-fixtures
- name: Run tests
@@ -178,8 +178,8 @@ jobs:
CHANGELOG_CACHE_FILE_PATH: tests/fixtures/changelog-feed.json
# By default, when `process.env.NODE_ENV === 'test'` it forces the
# tests run only in English. The exception is the
# `tests/translations/` suite which needs all languages to be set up.
ENABLED_LANGUAGES: ${{ matrix.name == 'translations' && 'all' || '' }}
# `languages` suite which needs all languages to be set up.
ENABLED_LANGUAGES: ${{ matrix.name == 'languages' && 'all' || '' }}
ROOT: ${{ (matrix.name == 'rendering-fixtures' || matrix.name == 'pageinfo' || matrix.name == 'landings' ) && 'tests/fixtures' || '' }}
TRANSLATIONS_FIXTURE_ROOT: ${{ (matrix.name == 'rendering-fixtures' || matrix.name == 'pageinfo') && 'tests/fixtures/translations' || '' }}
run: npm test -- ${{ matrix.path }}/

View File

@@ -9,7 +9,7 @@ import { SupportSection } from 'components/page-footer/SupportSection'
import { DeprecationBanner } from 'components/page-header/DeprecationBanner'
import { RestBanner } from 'src/rest/components/RestBanner'
import { useMainContext } from 'components/context/MainContext'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import { Breadcrumbs } from 'components/page-header/Breadcrumbs'
const MINIMAL_RENDER = Boolean(JSON.parse(process.env.MINIMAL_RENDER || 'false'))

View File

@@ -20,7 +20,7 @@ import { LearningTrackCard } from 'src/learning-track/components/article/Learnin
import { RestRedirect } from 'src/rest/components/RestRedirect'
import { Breadcrumbs } from 'components/page-header/Breadcrumbs'
import { Link } from 'components/Link'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import { LinkPreviewPopover } from 'components/LinkPreviewPopover'
const ClientSideRefresh = dynamic(() => import('components/ClientSideRefresh'), {

View File

@@ -1,7 +1,7 @@
import { GitPullRequestIcon } from '@primer/octicons-react'
import { useMainContext } from 'components/context/MainContext'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
export const Contribution = () => {
const { relativePath } = useMainContext()

View File

@@ -2,7 +2,7 @@ import Link from 'next/link'
import { useRouter } from 'next/router'
import { LinkExternalIcon } from '@primer/octicons-react'
import cx from 'classnames'
import { useTranslation } from '../hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
export const LegalFooter = () => {
const router = useRouter()

View File

@@ -1,6 +1,6 @@
import { PeopleIcon, CommentDiscussionIcon } from '@primer/octicons-react'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import { useMainContext } from 'components/context/MainContext'
export const Support = () => {

View File

@@ -6,7 +6,7 @@ import { Support } from 'components/page-footer/Support'
import { useMainContext } from 'components/context/MainContext'
import { useVersion } from 'components/hooks/useVersion'
import { useRouter } from 'next/router'
import { useTranslation } from '../hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
export const SupportSection = () => {
const { currentVersion } = useVersion()

View File

@@ -15,10 +15,10 @@ import { DEFAULT_VERSION, useVersion } from 'components/hooks/useVersion'
import { Link } from 'components/Link'
import { useMainContext } from 'components/context/MainContext'
import { useHasAccount } from 'components/hooks/useHasAccount'
import { LanguagePicker } from './LanguagePicker'
import { LanguagePicker } from 'src/languages/components/LanguagePicker'
import { HeaderNotifications } from 'components/page-header/HeaderNotifications'
import { ApiVersionPicker } from 'src/rest/components/ApiVersionPicker'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import { Search } from 'src/search/components/Search'
import { Breadcrumbs } from 'components/page-header/Breadcrumbs'
import { VersionPicker } from 'components/page-header/VersionPicker'

View File

@@ -2,12 +2,12 @@ import { useRouter } from 'next/router'
import cx from 'classnames'
import { XIcon } from '@primer/octicons-react'
import { useLanguages } from 'components/context/LanguagesContext'
import { useLanguages } from 'src/languages/components/LanguagesContext'
import { useMainContext } from 'components/context/MainContext'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import { ExcludesNull } from 'components/lib/ExcludesNull'
import { useVersion } from 'components/hooks/useVersion'
import { useUserLanguage } from 'components/hooks/useUserLanguage'
import { useUserLanguage } from 'src/languages/components/useUserLanguage'
import styles from './HeaderNotifications.module.scss'
enum NotificationType {

View File

@@ -3,7 +3,7 @@ import { ArrowRightIcon, InfoIcon } from '@primer/octicons-react'
import { useMainContext } from 'components/context/MainContext'
import { DEFAULT_VERSION, useVersion } from 'components/hooks/useVersion'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import { Picker } from 'src/tools/components/Picker'
import styles from './VersionPicker.module.scss'

View File

@@ -3,7 +3,7 @@ import { useEffect, useState } from 'react'
import cx from 'classnames'
import type { MiniTocItem } from 'components/context/ArticleContext'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import styles from './Minitocs.module.scss'

View File

@@ -1,7 +1,7 @@
import cx from 'classnames'
import styles from './PermissionsStatement.module.scss'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
type Props = {
permissions: string

View File

@@ -44,7 +44,7 @@ The [`script/bookmarklets`](../script/bookmarklets) directory contains some brow
By default the local server won't run with all supported languages enabled. If you need to run the server with a particular language, you can temporarily edit the `start` script in `package.json` and update the `ENABLED_LANGUAGES` variable. For example, to enable Japanese and Portuguese, you can set it to `ENABLED_LANGUAGES='en,ja,pt'` and then you need to restart the server for the change to take effect.
The supported language codes are defined in [lib/languages.js](../lib/languages.js).
The supported language codes are defined in [lib/languages.js](#src/languages/lib/languages.js).
## Site structure

View File

@@ -5,7 +5,7 @@ import yaml from 'js-yaml'
import matter from 'gray-matter'
import { merge, get } from 'lodash-es'
import languages from './languages.js'
import languages from '#src/languages/lib/languages.js'
import { correctTranslatedContentStrings } from './correct-translation-content.js'
// If you run `export DEBUG_JIT_DATA_READS=true` in your terminal,

View File

@@ -1,6 +1,6 @@
import path from 'path'
import languages from './languages.js'
import languages from '#src/languages/lib/languages.js'
import { allVersions } from './all-versions.js'
import createTree from './create-tree.js'
import nonEnterpriseDefaultVersion from './non-enterprise-default-version.js'

View File

@@ -8,7 +8,7 @@ import getEnglishHeadings from './get-english-headings.js'
import getTocItems from './get-toc-items.js'
import pathUtils from './path-utils.js'
import Permalink from './permalink.js'
import languages from './languages.js'
import languages from '#src/languages/lib/languages.js'
import { renderContent } from '#src/content-render/index.js'
import processLearningTracks from '#src/learning-track/lib/process-learning-tracks.js'
import { productMap } from './all-products.js'

View File

@@ -14,7 +14,7 @@ import { setFastlySurrogateKey, SURROGATE_ENUMS } from './set-fastly-surrogate-k
import got from 'got'
import { readCompressedJsonFileFallbackLazily } from '../lib/read-json-file.js'
import { archivedCacheControl, languageCacheControl } from './cache-control.js'
import { pathLanguagePrefixed, languagePrefixPathRegex } from '../lib/languages.js'
import { pathLanguagePrefixed, languagePrefixPathRegex } from '#src/languages/lib/languages.js'
import getRedirect, { splitPathByLanguage } from '../src/redirects/lib/get-redirect.js'
import getRemoteJSON from './get-remote-json.js'

View File

@@ -1,4 +1,4 @@
import languages from '../lib/languages.js'
import languages from '#src/languages/lib/languages.js'
import enterpriseServerReleases from '../lib/enterprise-server-releases.js'
import { allVersions } from '../lib/all-versions.js'
import { productMap } from '../lib/all-products.js'

View File

@@ -1,6 +1,6 @@
import { getProductGroups } from '../../lib/get-product-groups.js'
import warmServer from '../../lib/warm-server.js'
import { languageKeys } from '../../lib/languages.js'
import { languageKeys } from '#src/languages/lib/languages.js'
import { allVersionKeys } from '../../lib/all-versions.js'
const isHomepage = (path) => {

View File

@@ -3,7 +3,7 @@ import { existsSync } from 'fs'
import { ROOT } from '../lib/constants.js'
import Page from '../lib/page.js'
import { languagePrefixPathRegex } from '../lib/languages.js'
import { languagePrefixPathRegex } from '#src/languages/lib/languages.js'
const englishPrefixRegex = /^\/en(\/|$)/
const CONTENT_ROOT = path.join(ROOT, 'content')

View File

@@ -17,7 +17,7 @@ import {
} from './set-fastly-surrogate-key.js'
import handleErrors from '#src/observability/middleware/handle-errors.js'
import handleNextDataPath from './handle-next-data-path.js'
import detectLanguage from './detect-language.js'
import detectLanguage from '#src/languages/middleware/detect-language.js'
import reloadTree from './reload-tree.js'
import context from './context.js'
import shortVersions from './contextualizers/short-versions.js'

View File

@@ -16,7 +16,7 @@
import path from 'path'
import languages, { languageKeys } from '../lib/languages.js'
import languages, { languageKeys } from '#src/languages/lib/languages.js'
import createTree from '../lib/create-tree.js'
import warmServer from '../lib/warm-server.js'
import { loadSiteTree, loadPages, loadPageMap } from '../lib/page-data.js'

View File

@@ -4,7 +4,7 @@ import FailBot from '#src/observability/lib/failbot.js'
import patterns from '../lib/patterns.js'
import getMiniTocItems from '../lib/get-mini-toc-items.js'
import Page from '../lib/page.js'
import { pathLanguagePrefixed } from '../lib/languages.js'
import { pathLanguagePrefixed } from '#src/languages/lib/languages.js'
import statsd from '#src/observability/lib/statsd.js'
import { allVersions } from '../lib/all-versions.js'
import { isConnectionDropped } from './halt-on-dropped-connection.js'

View File

@@ -2,7 +2,7 @@ import fs from 'fs'
import path from 'path'
import frontmatter from 'gray-matter'
import { languageKeys } from './lib/languages.js'
import { languageKeys } from '#src/languages/lib/languages.js'
import { ROOT } from './lib/constants.js'
const homepage = path.posix.join(ROOT, 'content/index.md')

View File

@@ -12,7 +12,7 @@ import fs from 'fs/promises'
import path from 'path'
import { program } from 'commander'
import { execSync } from 'child_process'
import libLanguages from '../lib/languages.js'
import libLanguages from '#src/languages/lib/languages.js'
import { getPathWithoutLanguage } from '../lib/path-utils.js'
const languageCodes = Object.keys(libLanguages)

View File

@@ -13,7 +13,7 @@ import { program } from 'commander'
import walk from 'walk-sync'
import walkFiles from '../../../script/helpers/walk-files.js'
import languages from '../../../lib/languages.js'
import languages from '#src/languages/lib/languages.js'
const EXCEPTIONS = new Set([
'assets/images/site/favicon.ico',

View File

@@ -1,6 +1,6 @@
import cx from 'classnames'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import { ParameterRow } from './ParameterRow'
import type { ChildParameter } from './types'

View File

@@ -1,6 +1,6 @@
import cx from 'classnames'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import { ChildBodyParametersRows } from './ChildBodyParametersRows'
import type { ChildParameter } from './types'

View File

@@ -1,5 +1,5 @@
import cx from 'classnames'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import { ParameterRow } from './ParameterRow'
import { BodyParameter, ChildParameter, Parameter } from './types'

View File

@@ -7,7 +7,7 @@ import { visitParents } from 'unist-util-visit-parents'
import { visit, SKIP } from 'unist-util-visit'
import { remove } from 'unist-util-remove'
import { languageKeys } from '../../../lib/languages.js'
import { languageKeys } from '#src/languages/lib/languages.js'
import { MARKDOWN_OPTIONS } from '../../content-linter/lib/helpers/unified-formatter-options.js'
const { targetDirectory, removeKeywords } = JSON.parse(

View File

@@ -1,7 +1,7 @@
import { filterTokens } from 'markdownlint-rule-helpers'
import { addFixErrorDetail, getRange } from '../helpers/utils.js'
import { languageKeys } from '../../../../lib/languages.js'
import { languageKeys } from '#src/languages/lib/languages.js'
export const internalLinksLang = {
names: ['GHD005', 'internal-links-lang'],

View File

@@ -15,7 +15,7 @@ import semver from 'semver'
import { jest } from '@jest/globals'
import { frontmatter, deprecatedProperties } from '../../../lib/frontmatter.js'
import languages from '../../../lib/languages.js'
import languages from '#src/languages/lib/languages.js'
import releaseNotesSchema from '../lib/release-notes-schema.js'
import learningTracksSchema from '../lib/learning-tracks-schema.js'
import { liquid } from '#src/content-render/index.js'

View File

@@ -1,7 +1,7 @@
import { afterAll, beforeAll, expect, describe, it } from '@jest/globals'
import Page from '../../../lib/page.js'
import languages from '../../../lib/languages.js'
import languages from '#src/languages/lib/languages.js'
import nonEnterpriseDefaultVersion from '../../../lib/non-enterprise-default-version.js'
import { DataDirectory } from '../../../tests/helpers/data-directory.js'

View File

@@ -1,6 +1,6 @@
import { afterAll, jest, beforeAll, expect } from '@jest/globals'
import { liquid } from '#src/content-render/index.js'
import languages from '../../../lib/languages.js'
import languages from '#src/languages/lib/languages.js'
import { DataDirectory } from '../../../tests/helpers/data-directory.js'
describe('liquid helper tags', () => {

View File

@@ -2,7 +2,7 @@ import { expect, jest, test } from '@jest/globals'
import { get, getDOM } from '../../../tests/helpers/e2etest.js'
import { describeIfDocsEarlyAccess } from '../../../tests/helpers/conditional-runs.js'
import languages from '../../../lib/languages.js'
import languages from '#src/languages/lib/languages.js'
const VALID_EARLY_ACCESS_URI = '/early-access/github/save-time-with-slash-commands'

View File

@@ -2,7 +2,7 @@ import { useState, useRef, useEffect } from 'react'
import cx from 'classnames'
import { useRouter } from 'next/router'
import { ThumbsdownIcon, ThumbsupIcon } from '@primer/octicons-react'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import { Link } from 'components/Link'
import { sendEvent, EventType } from 'src/events/components/events'

View File

@@ -1,4 +1,4 @@
import { languageKeys } from '../../../lib/languages.js'
import { languageKeys } from '#src/languages/lib/languages.js'
import { allVersionKeys } from '../../../lib/all-versions.js'
import { productIds } from '../../../lib/all-products.js'
import { allTools } from '#src/tools/lib/all-tools.js'

View File

@@ -10,7 +10,7 @@ import {
LanguagesContext,
LanguagesContextT,
LanguageItem,
} from 'components/context/LanguagesContext'
} from 'src/languages/components/LanguagesContext'
import { useTheme } from 'components/hooks/useTheme'
type MyAppProps = AppProps & {

View File

@@ -19,7 +19,7 @@ import createApp from '../../../lib/app.js'
import EnterpriseServerReleases from '../../../lib/enterprise-server-releases.js'
import loadRedirects from '#src/redirects/lib/precompile.js'
import { loadPageMap } from '../../../lib/page-data.js'
import { languageKeys } from '../../../lib/languages.js'
import { languageKeys } from '#src/languages/lib/languages.js'
const port = '4001'
const host = `http://localhost:${port}`

View File

@@ -3,7 +3,7 @@ import cx from 'classnames'
import { slug as githubSlug } from 'github-slugger'
import { HeadingLink } from 'components/article/HeadingLink'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import { Link } from 'components/Link'
import { MainContextT } from 'components/context/MainContext'
import {

View File

@@ -1,6 +1,6 @@
import React from 'react'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import { GraphqlItem } from './GraphqlItem'
import type { EnumT } from './types'

View File

@@ -1,6 +1,6 @@
import { GraphqlItem } from './GraphqlItem'
import { Table } from './Table'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import type { InputObjectT } from './types'
type Props = {

View File

@@ -3,7 +3,7 @@ import { useRouter } from 'next/router'
import { Link } from 'components/Link'
import { GraphqlItem } from './GraphqlItem'
import { Table } from './Table'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import type { ObjectT, InterfaceT } from './types'
type Props = {

View File

@@ -3,7 +3,7 @@ import { useRouter } from 'next/router'
import { Link } from 'components/Link'
import { GraphqlItem } from './GraphqlItem'
import { Notice } from './Notice'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import { Table } from './Table'
import type { MutationT } from './types'
import React from 'react'

View File

@@ -1,7 +1,7 @@
import { useRouter } from 'next/router'
import { Link } from 'components/Link'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import type { GraphqlT } from './types'
type Props = {

View File

@@ -3,7 +3,7 @@ import { useRouter } from 'next/router'
import { Link } from 'components/Link'
import { GraphqlItem } from './GraphqlItem'
import { Table } from './Table'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import type { ObjectT, ImplementsT } from './types'
type Props = {

View File

@@ -3,7 +3,7 @@ import GithubSlugger from 'github-slugger'
import cx from 'classnames'
import { HeadingLink } from 'components/article/HeadingLink'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import { PreviewT } from './types'
import styles from 'components/ui/MarkdownContent/MarkdownContent.module.scss'

View File

@@ -3,7 +3,7 @@ import { useRouter } from 'next/router'
import { Link } from 'components/Link'
import { GraphqlItem } from './GraphqlItem'
import { Table } from './Table'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import type { QueryT } from './types'
type Props = {

View File

@@ -2,7 +2,7 @@ import { useRouter } from 'next/router'
import { Link } from 'components/Link'
import { Notice } from './Notice'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import { FieldT } from './types'
type Props = {

View File

@@ -2,7 +2,7 @@ import { useRouter } from 'next/router'
import { Link } from 'components/Link'
import { GraphqlItem } from './GraphqlItem'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import type { UnionT } from './types'
type Props = {

View File

@@ -3,7 +3,7 @@ import {
readCompressedJsonFileFallback,
} from '../../../lib/read-json-file.js'
import { getAutomatedPageMiniTocItems } from '../../../lib/get-mini-toc-items.js'
import languages from '../../../lib/languages.js'
import languages from '#src/languages/lib/languages.js'
import { allVersions } from '../../../lib/all-versions.js'
export const GRAPHQL_DATA_DIR = 'src/graphql/data'

View File

@@ -1,7 +1,7 @@
import React, { useRef } from 'react'
import { useProductGuidesContext } from 'src/landings/components/ProductGuidesContext'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import { ArticleCard } from './ArticleCard'
import { ItemInput } from '@primer/react/lib/deprecated/ActionList/List'

View File

@@ -1,7 +1,7 @@
import cx from 'classnames'
import dayjs from 'dayjs'
import { ActionList } from '@primer/react'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import { Link } from 'components/Link'
import { ArrowRightIcon } from '@primer/octicons-react'
import { FeaturedLink } from 'src/landings/components/ProductLandingContext'

View File

@@ -1,7 +1,7 @@
import cx from 'classnames'
import { useProductLandingContext } from 'src/landings/components/ProductLandingContext'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import { ArticleList } from 'src/landings/components/ArticleList'
export const FeaturedArticles = () => {

View File

@@ -6,7 +6,7 @@ import { useMainContext } from 'components/context/MainContext'
import { useProductLandingContext } from 'src/landings/components/ProductLandingContext'
import { GuideCard } from 'src/landings/components/GuideCard'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
export const GuideCards = () => {
const router = useRouter()

View File

@@ -1,5 +1,5 @@
import { OctocatHeader } from 'src/landings/components/OctocatHeader'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
export const HomePageHero = () => {
const { t } = useTranslation(['header', 'homepage'])

View File

@@ -5,7 +5,7 @@ import { LinkExternalIcon, NoteIcon } from '@primer/octicons-react'
import { Link } from 'components/Link'
import { useProductLandingContext } from 'src/landings/components/ProductLandingContext'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import { useVersion } from 'components/hooks/useVersion'
import { Lead } from 'components/ui/Lead'

View File

@@ -4,7 +4,7 @@ import { LandingSection } from 'src/landings/components/LandingSection'
import { GuidesHero } from 'src/landings/components/GuidesHero'
import { LearningTracks } from 'src/learning-track/components/guides/LearningTracks'
import { ArticleCards } from 'src/landings/components/ArticleCards'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import { useMainContext } from 'components/context/MainContext'
export const ProductGuides = () => {

View File

@@ -8,7 +8,7 @@ import { GuideCards } from 'src/landings/components/GuideCards'
import { SponsorsExamples } from 'src/landings/components/SponsorsExamples'
import { CommunityExamples } from 'src/landings/components/CommunityExamples'
import { LandingSection } from 'src/landings/components/LandingSection'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import { ProductArticlesList } from 'src/landings/components/ProductArticlesList'
import { ProductReleases } from 'src/landings/components/ProductReleases'
import { useVersion } from 'components/hooks/useVersion'

View File

@@ -1,7 +1,7 @@
import { ArrowRightIcon, ArrowUpIcon, FileIcon, ListUnorderedIcon } from '@primer/octicons-react'
import { useMainContext } from 'components/context/MainContext'
import { useProductLandingContext } from 'src/landings/components/ProductLandingContext'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import { Link } from 'components/Link'
import { useRouter } from 'next/router'

View File

@@ -2,7 +2,7 @@ import { useRouter } from 'next/router'
import cx from 'classnames'
import { useTocLandingContext } from 'components/context/TocLandingContext'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import { DefaultLayout } from 'components/DefaultLayout'
import { TableOfContents } from 'src/landings/components/TableOfContents'
import { ArticleTitle } from 'components/article/ArticleTitle'

View File

@@ -4,7 +4,7 @@ import type { GetServerSideProps } from 'next'
import { MainContextT, MainContext, getMainContext } from 'components/context/MainContext'
import { DefaultLayout } from 'components/DefaultLayout'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import { ArticleList } from 'src/landings/components/ArticleList'
import { HomePageHero } from 'src/landings/components/HomePageHero'
import type { ProductGroupT } from 'src/landings/components/ProductSelections'

19
src/languages/README.md Normal file
View File

@@ -0,0 +1,19 @@
# LANGUAGES
TBD what is LANGUAGES
## What LANGUAGES does
TBD why is LANGUAGES on the docs
## How LANGUAGES works
TBD step-by-step instructions to work on LANGUAGES
## How to work on LANGUAGES
TBD step-by-step instructions on how to work on LANGUAGES
## How to get help for LANGUAGES
TBD reference material

View File

@@ -1,9 +1,9 @@
import { useRouter } from 'next/router'
import { GlobeIcon } from '@primer/octicons-react'
import { useLanguages } from 'components/context/LanguagesContext'
import { useTranslation } from 'components/hooks/useTranslation'
import { useUserLanguage } from 'components/hooks/useUserLanguage'
import { useLanguages } from 'src/languages/components/LanguagesContext'
import { useTranslation } from 'src/languages/components/useTranslation'
import { useUserLanguage } from 'src/languages/components/useUserLanguage'
import { ActionList, ActionMenu, IconButton, Link } from '@primer/react'
type Props = {

View File

@@ -2,8 +2,8 @@ import { useState, useEffect } from 'react'
import Cookies from 'components/lib/cookies'
import { useRouter } from 'next/router'
import { useLanguages } from 'components/context/LanguagesContext'
import { USER_LANGUAGE_COOKIE_NAME } from '../../lib/constants.js'
import { useLanguages } from 'src/languages/components/LanguagesContext'
import { USER_LANGUAGE_COOKIE_NAME } from '../../../lib/constants.js'
export function useUserLanguage() {
const { locale } = useRouter()

View File

@@ -6,7 +6,7 @@ import fs from 'fs'
import dotenv from 'dotenv'
import { ROOT, TRANSLATIONS_ROOT, TRANSLATIONS_FIXTURE_ROOT } from './constants.js'
import { ROOT, TRANSLATIONS_ROOT, TRANSLATIONS_FIXTURE_ROOT } from '../../../lib/constants.js'
dotenv.config()

View File

@@ -1,7 +1,7 @@
import languages, { languageKeys } from '../lib/languages.js'
import languages, { languageKeys } from '#src/languages/lib/languages.js'
import parser from 'accept-language-parser'
import { USER_LANGUAGE_COOKIE_NAME } from '../lib/constants.js'
import { USER_LANGUAGE_COOKIE_NAME } from '../../../lib/constants.js'
const chineseRegions = [
'CN', // Mainland

View File

@@ -59,11 +59,11 @@ console.warn = console.error = (...args) => {
}
// Weird import syntax, but forces it to load after process.env... changes
const { languageKeys } = await import('../../lib/languages.js')
const { loadPages, loadPageMap } = await import('../../lib/page-data.js')
const { precompileRedirects } = await import('../../src/redirects/lib/precompile.js')
const { allVersions, allVersionKeys } = await import('../../lib/all-versions.js')
const { getProductStringFromPath } = await import('../../lib/path-utils.js')
const { languageKeys } = await import('#src/languages/lib/languages.js')
const { loadPages, loadPageMap } = await import('../../../lib/page-data.js')
const { precompileRedirects } = await import('../../../src/redirects/lib/precompile.js')
const { allVersions, allVersionKeys } = await import('../../../lib/all-versions.js')
const { getProductStringFromPath } = await import('../../../lib/path-utils.js')
// Check that the language is valid
const { language, gitref } = program.opts()

View File

@@ -1,9 +1,9 @@
#!/usr/bin/env node
import { languageKeys } from '../../lib/languages.js'
import { languageKeys } from '#src/languages/lib/languages.js'
import { makeLanguageSurrogateKey } from '../../middleware/set-fastly-surrogate-key.js'
import purgeEdgeCache from '../../script/deployment/purge-edge-cache.js'
import { makeLanguageSurrogateKey } from '../../../middleware/set-fastly-surrogate-key.js'
import purgeEdgeCache from '../../../script/deployment/purge-edge-cache.js'
/**
* In simple terms, this script sends purge commands for...

View File

@@ -13,9 +13,9 @@ import Bottleneck from 'bottleneck'
// npm install --include=optional
//
import { loadPages } from '../../lib/page-data.js'
import { allVersions } from '../../lib/all-versions.js'
import languages from '../../lib/languages.js'
import { loadPages } from '../../../lib/page-data.js'
import { allVersions } from '../../../lib/all-versions.js'
import languages from '#src/languages/lib/languages.js'
const port = 4002
dotenv.config()

View File

@@ -1,7 +1,7 @@
import { jest, test, expect } from '@jest/globals'
import { describeIfElasticsearchURL } from '../helpers/conditional-runs.js'
import { get } from '../helpers/e2etest.js'
import { describeIfElasticsearchURL } from '../../../tests/helpers/conditional-runs.js'
import { get } from '../../../tests/helpers/e2etest.js'
// This suite only runs if $ELASTICSEARCH_URL is set.
describeIfElasticsearchURL('search v1 middleware in non-English', () => {

View File

@@ -1,4 +1,4 @@
import languages from '../../lib/languages.js'
import languages from '#src/languages/lib/languages.js'
import { jest } from '@jest/globals'
describe('files', () => {

View File

@@ -1,7 +1,7 @@
import { languageKeys } from '../../lib/languages.js'
import { blockIndex } from '../../middleware/block-robots.js'
import { get, getDOMCached as getDOM } from '../helpers/e2etest.js'
import Page from '../../lib/page.js'
import { languageKeys } from '#src/languages/lib/languages.js'
import { blockIndex } from '../../../middleware/block-robots.js'
import { get, getDOMCached as getDOM } from '../../../tests/helpers/e2etest.js'
import Page from '../../../lib/page.js'
import { jest } from '@jest/globals'
const langs = languageKeys.filter((lang) => lang !== 'en')

View File

@@ -1,5 +1,5 @@
import { languageKeys } from '../../lib/languages.js'
import { getDOM } from '../helpers/e2etest.js'
import { languageKeys } from '#src/languages/lib/languages.js'
import { getDOM } from '../../../tests/helpers/e2etest.js'
const langs = languageKeys.filter((lang) => lang !== 'en')

View File

@@ -1,6 +1,6 @@
import { languageKeys } from '../../lib/languages.js'
import { get } from '../helpers/e2etest.js'
import { USER_LANGUAGE_COOKIE_NAME } from '../../lib/constants.js'
import { languageKeys } from '#src/languages/lib/languages.js'
import { get } from '../../../tests/helpers/e2etest.js'
import { USER_LANGUAGE_COOKIE_NAME } from '../../../lib/constants.js'
const langs = languageKeys.filter((lang) => lang !== 'en')

View File

@@ -1,5 +1,5 @@
import { languageKeys } from '../../lib/languages'
import { get } from '../helpers/e2etest.js'
import { languageKeys } from '#src/languages/lib/languages'
import { get } from '../../../tests/helpers/e2etest.js'
const langs = languageKeys.filter((lang) => lang !== 'en')

View File

@@ -2,7 +2,7 @@ import { useRouter } from 'next/router'
import { Link } from 'components/Link'
import type { LearningTrack } from 'components/context/ArticleContext'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
type Props = {
track: LearningTrack

View File

@@ -1,6 +1,6 @@
import { Link } from 'components/Link'
import type { LearningTrack } from 'components/context/ArticleContext'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
type Props = {
track: LearningTrack

View File

@@ -1,4 +1,4 @@
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import { ArrowRightIcon } from '@primer/octicons-react'
import { LearningTrack as LearningTrackT } from 'src/landings/components/ProductGuidesContext'
import { Link } from 'components/Link'

View File

@@ -1,4 +1,4 @@
import { languageKeys } from '../../../lib/languages.js'
import { languageKeys } from '#src/languages/lib/languages.js'
import nonEnterpriseDefaultVersion from '../../../lib/non-enterprise-default-version.js'
import { allVersions } from '../../../lib/all-versions.js'
import {

View File

@@ -1,6 +1,6 @@
import patterns from '../../../lib/patterns.js'
import { URL } from 'url'
import { pathLanguagePrefixed } from '../../../lib/languages.js'
import { pathLanguagePrefixed } from '#src/languages/lib/languages.js'
import { deprecatedWithFunctionalRedirects } from '../../../lib/enterprise-server-releases.js'
import getRedirect from '../lib/get-redirect.js'
import { defaultCacheControl, languageCacheControl } from '../../../middleware/cache-control.js'

View File

@@ -1,4 +1,4 @@
import languages from '../../../lib/languages.js'
import languages from '#src/languages/lib/languages.js'
import { defaultCacheControl } from '../../../middleware/cache-control.js'
const redirectPatterns = Object.values(languages)

View File

@@ -1,7 +1,7 @@
import { useRef } from 'react'
import dayjs from 'dayjs'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import { PatchNotes } from './PatchNotes'
import { CurrentVersion, ReleaseNotePatch } from './types'

View File

@@ -1,7 +1,7 @@
import { useRef } from 'react'
import dayjs from 'dayjs'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import { PatchNotes } from './PatchNotes'
import { Link } from 'components/Link'
import { CurrentVersion, ReleaseNotePatch, GHESMessage } from './types'

View File

@@ -5,7 +5,7 @@ import { InfoIcon } from '@primer/octicons-react'
import { useMainContext } from 'components/context/MainContext'
import { DEFAULT_VERSION, useVersion } from 'components/hooks/useVersion'
import { Picker } from 'src/tools/components/Picker'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import { API_VERSION_COOKIE_NAME } from 'src/rest/components/RestRedirect'
const API_VERSION_SUFFIX = ' (latest)'

View File

@@ -5,7 +5,7 @@ import { useRouter } from 'next/router'
import { DEFAULT_VERSION, useVersion } from 'components/hooks/useVersion'
import { Link } from 'components/Link'
import { useMainContext } from 'components/context/MainContext'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
const restRepoDisplayPages = [
'branches',

View File

@@ -9,7 +9,7 @@ import json from 'highlight.js/lib/languages/json'
import javascript from 'highlight.js/lib/languages/javascript'
import hljsCurl from 'highlightjs-curl'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import useClipboard from 'src/rest/components/useClipboard'
import {
getShellExample,

View File

@@ -5,7 +5,7 @@ import cx from 'classnames'
import { HeadingLink } from 'components/article/HeadingLink'
import { Link } from 'components/Link'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import { RestPreviewNotice } from './RestPreviewNotice'
import { ParameterTable } from 'src/automated-pipelines/components/parameter-table/ParameterTable'
import { RestCodeSamples } from './RestCodeSamples'

View File

@@ -1,4 +1,4 @@
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import { StatusCode } from './types'
type Props = {

View File

@@ -4,7 +4,7 @@ import path from 'path'
import { readCompressedJsonFileFallback } from '../../../lib/read-json-file.js'
import { getAutomatedPageMiniTocItems } from '../../../lib/get-mini-toc-items.js'
import { allVersions, getOpenApiVersion } from '../../../lib/all-versions.js'
import languages from '../../../lib/languages.js'
import languages from '#src/languages/lib/languages.js'
export const REST_DATA_DIR = 'src/rest/data'
export const REST_SCHEMA_FILENAME = 'schema.json'

View File

@@ -1,7 +1,7 @@
import { Heading, Flash } from '@primer/react'
import { useMainContext } from 'components/context/MainContext'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
export function NoQuery() {
const { t } = useTranslation(['search'])

View File

@@ -3,7 +3,7 @@ import { useRouter } from 'next/router'
import { IconButton, TextInput } from '@primer/react'
import { SearchIcon } from '@primer/octicons-react'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import { DEFAULT_VERSION, useVersion } from 'components/hooks/useVersion'
import { useQuery } from 'src/search/components/useQuery'
import { useBreakpoint } from 'src/search/components/useBreakpoint'

View File

@@ -4,7 +4,7 @@ import { useRouter } from 'next/router'
import cx from 'classnames'
import type { SearchResultsT, SearchResultHitT, SearchQueryT } from './types'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import { Link } from 'components/Link'
import { sendEvent, EventType } from 'src/events/components/events'

View File

@@ -1,6 +1,6 @@
import { Flash } from '@primer/react'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import type { SearchValidationErrorT } from './types'
interface Props {

View File

@@ -2,7 +2,7 @@ import Head from 'next/head'
import { Heading } from '@primer/react'
import type { SearchT } from 'src/search/components/types'
import { useTranslation } from 'components/hooks/useTranslation'
import { useTranslation } from 'src/languages/components/useTranslation'
import { DEFAULT_VERSION, useVersion } from 'components/hooks/useVersion'
import { useNumberFormatter } from 'src/search/components/useNumberFormatter'
import { SearchResults } from 'src/search/components/SearchResults'

View File

@@ -1,6 +1,6 @@
import { format } from 'node:util'
import languages from '../../../lib/languages.js'
import languages from '#src/languages/lib/languages.js'
import { allVersions } from '../../../lib/all-versions.js'
import { POSSIBLE_HIGHLIGHT_FIELDS, DEFAULT_HIGHLIGHT_FIELDS } from './es-search.js'

Some files were not shown because too many files have changed in this diff Show More