Skip to content

Commit 9bf3fc1

Browse files
authored
Create languages src directory (#41661)
1 parent df29357 commit 9bf3fc1

File tree

108 files changed

+153
-134
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+153
-134
lines changed

.github/workflows/purge-fastly.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ jobs:
4646
if: ${{ !inputs.nuke_all }}
4747
env:
4848
LANGUAGES: ${{ inputs.languages }}
49-
run: .github/actions-scripts/purge-fastly-edge-cache-per-language.js
49+
run: src/languages/scripts/purge-fastly-edge-cache-per-language.js

.github/workflows/test.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ jobs:
3434
id: set-matrix
3535
with:
3636
script: |
37-
// We only want to run the 'translations' suite when we know
37+
// We only want to run the 'languages' suite when we know
3838
// we're on the private docs-internal repo because only that
39-
// one has ability to clone the remote (private) translations
39+
// one has ability to clone the remote (private) languages
4040
// repos.
4141
// You can run multiple paths per suite as space-separated in `path`.
4242
// Note that *if you add* to this, remember to also add that
@@ -64,7 +64,7 @@ jobs:
6464
{ name: 'search', path: 'src/search/tests', },
6565
{ name: 'shielding', path: 'src/shielding/tests', },
6666
context.payload.repository.full_name === 'github/docs-internal' &&
67-
{ name: 'translations', path: 'tests/translations', },
67+
{ name: 'languages', path: 'src/languages/tests', },
6868
{ name: 'unit', path: 'tests/unit', },
6969
// { name: 'tools', path: 'src/tools/tests', }
7070
{ name: 'webhooks', path: 'src/webhooks/tests', },
@@ -88,7 +88,7 @@ jobs:
8888
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
8989

9090
- uses: ./.github/actions/setup-elasticsearch
91-
if: ${{ matrix.name == 'search' || matrix.name == 'translations' }}
91+
if: ${{ matrix.name == 'search' || matrix.name == 'languages' }}
9292

9393
- uses: ./.github/actions/node-npm-setup
9494

@@ -117,7 +117,7 @@ jobs:
117117
tests/fixtures/data
118118
119119
- name: Clone all translations
120-
if: ${{ matrix.name == 'translations' }}
120+
if: ${{ matrix.name == 'languages' }}
121121
uses: ./.github/actions/clone-translations
122122
with:
123123
token: ${{ secrets.DOCS_BOT_PAT_READPUBLICKEY }}
@@ -169,7 +169,7 @@ jobs:
169169
- name: Index fixtures into the local Elasticsearch
170170
# For the sake of saving time, only run this step if the group
171171
# is one that will run tests against an Elasticsearch on localhost.
172-
if: ${{ matrix.name == 'search' || matrix.name == 'translations' }}
172+
if: ${{ matrix.name == 'search' || matrix.name == 'languages' }}
173173
run: npm run index-test-fixtures
174174

175175
- name: Run tests
@@ -178,8 +178,8 @@ jobs:
178178
CHANGELOG_CACHE_FILE_PATH: tests/fixtures/changelog-feed.json
179179
# By default, when `process.env.NODE_ENV === 'test'` it forces the
180180
# tests run only in English. The exception is the
181-
# `tests/translations/` suite which needs all languages to be set up.
182-
ENABLED_LANGUAGES: ${{ matrix.name == 'translations' && 'all' || '' }}
181+
# `languages` suite which needs all languages to be set up.
182+
ENABLED_LANGUAGES: ${{ matrix.name == 'languages' && 'all' || '' }}
183183
ROOT: ${{ (matrix.name == 'rendering-fixtures' || matrix.name == 'pageinfo' || matrix.name == 'landings' ) && 'tests/fixtures' || '' }}
184184
TRANSLATIONS_FIXTURE_ROOT: ${{ (matrix.name == 'rendering-fixtures' || matrix.name == 'pageinfo') && 'tests/fixtures/translations' || '' }}
185185
run: npm test -- ${{ matrix.path }}/

components/DefaultLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { SupportSection } from 'components/page-footer/SupportSection'
99
import { DeprecationBanner } from 'components/page-header/DeprecationBanner'
1010
import { RestBanner } from 'src/rest/components/RestBanner'
1111
import { useMainContext } from 'components/context/MainContext'
12-
import { useTranslation } from 'components/hooks/useTranslation'
12+
import { useTranslation } from 'src/languages/components/useTranslation'
1313
import { Breadcrumbs } from 'components/page-header/Breadcrumbs'
1414

1515
const MINIMAL_RENDER = Boolean(JSON.parse(process.env.MINIMAL_RENDER || 'false'))

components/article/ArticlePage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { LearningTrackCard } from 'src/learning-track/components/article/Learnin
2020
import { RestRedirect } from 'src/rest/components/RestRedirect'
2121
import { Breadcrumbs } from 'components/page-header/Breadcrumbs'
2222
import { Link } from 'components/Link'
23-
import { useTranslation } from 'components/hooks/useTranslation'
23+
import { useTranslation } from 'src/languages/components/useTranslation'
2424
import { LinkPreviewPopover } from 'components/LinkPreviewPopover'
2525

2626
const ClientSideRefresh = dynamic(() => import('components/ClientSideRefresh'), {

components/page-footer/Contribution.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { GitPullRequestIcon } from '@primer/octicons-react'
22

33
import { useMainContext } from 'components/context/MainContext'
4-
import { useTranslation } from 'components/hooks/useTranslation'
4+
import { useTranslation } from 'src/languages/components/useTranslation'
55

66
export const Contribution = () => {
77
const { relativePath } = useMainContext()

components/page-footer/LegalFooter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Link from 'next/link'
22
import { useRouter } from 'next/router'
33
import { LinkExternalIcon } from '@primer/octicons-react'
44
import cx from 'classnames'
5-
import { useTranslation } from '../hooks/useTranslation'
5+
import { useTranslation } from 'src/languages/components/useTranslation'
66

77
export const LegalFooter = () => {
88
const router = useRouter()

components/page-footer/Support.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { PeopleIcon, CommentDiscussionIcon } from '@primer/octicons-react'
22

3-
import { useTranslation } from 'components/hooks/useTranslation'
3+
import { useTranslation } from 'src/languages/components/useTranslation'
44
import { useMainContext } from 'components/context/MainContext'
55

66
export const Support = () => {

components/page-footer/SupportSection.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Support } from 'components/page-footer/Support'
66
import { useMainContext } from 'components/context/MainContext'
77
import { useVersion } from 'components/hooks/useVersion'
88
import { useRouter } from 'next/router'
9-
import { useTranslation } from '../hooks/useTranslation'
9+
import { useTranslation } from 'src/languages/components/useTranslation'
1010

1111
export const SupportSection = () => {
1212
const { currentVersion } = useVersion()

components/page-header/Header.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ import { DEFAULT_VERSION, useVersion } from 'components/hooks/useVersion'
1515
import { Link } from 'components/Link'
1616
import { useMainContext } from 'components/context/MainContext'
1717
import { useHasAccount } from 'components/hooks/useHasAccount'
18-
import { LanguagePicker } from './LanguagePicker'
18+
import { LanguagePicker } from 'src/languages/components/LanguagePicker'
1919
import { HeaderNotifications } from 'components/page-header/HeaderNotifications'
2020
import { ApiVersionPicker } from 'src/rest/components/ApiVersionPicker'
21-
import { useTranslation } from 'components/hooks/useTranslation'
21+
import { useTranslation } from 'src/languages/components/useTranslation'
2222
import { Search } from 'src/search/components/Search'
2323
import { Breadcrumbs } from 'components/page-header/Breadcrumbs'
2424
import { VersionPicker } from 'components/page-header/VersionPicker'

components/page-header/HeaderNotifications.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import { useRouter } from 'next/router'
22
import cx from 'classnames'
33
import { XIcon } from '@primer/octicons-react'
44

5-
import { useLanguages } from 'components/context/LanguagesContext'
5+
import { useLanguages } from 'src/languages/components/LanguagesContext'
66
import { useMainContext } from 'components/context/MainContext'
7-
import { useTranslation } from 'components/hooks/useTranslation'
7+
import { useTranslation } from 'src/languages/components/useTranslation'
88
import { ExcludesNull } from 'components/lib/ExcludesNull'
99
import { useVersion } from 'components/hooks/useVersion'
10-
import { useUserLanguage } from 'components/hooks/useUserLanguage'
10+
import { useUserLanguage } from 'src/languages/components/useUserLanguage'
1111
import styles from './HeaderNotifications.module.scss'
1212

1313
enum NotificationType {

0 commit comments

Comments
 (0)