From 8216de8f87f46ce30cfa1565002bc61ea669e798 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Wed, 28 Jun 2023 07:55:00 -0400 Subject: [PATCH] Remove banner to say the translations is incomplete (#38634) --- components/lib/localization.ts | 9 --------- components/page-header/HeaderNotifications.tsx | 5 ----- data/ui.yml | 4 ---- src/landings/pages/product.tsx | 2 -- tests/fixtures/data/ui.yml | 4 ---- .../playwright-rendering.spec.ts | 15 --------------- tests/rendering-fixtures/translations.js | 7 ------- 7 files changed, 46 deletions(-) delete mode 100644 components/lib/localization.ts diff --git a/components/lib/localization.ts b/components/lib/localization.ts deleted file mode 100644 index 0a11d22c67..0000000000 --- a/components/lib/localization.ts +++ /dev/null @@ -1,9 +0,0 @@ -export default function localization() { - const linkToEnglish = document.querySelector('#to-english-doc') as HTMLAnchorElement - - if (linkToEnglish) { - const pathname = window.location.pathname.split('/') - pathname[1] = 'en' - linkToEnglish.href = pathname.join('/') - } -} diff --git a/components/page-header/HeaderNotifications.tsx b/components/page-header/HeaderNotifications.tsx index 26d7cceec4..42c0621a1e 100644 --- a/components/page-header/HeaderNotifications.tsx +++ b/components/page-header/HeaderNotifications.tsx @@ -46,11 +46,6 @@ export const HeaderNotifications = () => { type: NotificationType.TRANSLATION, content: data.reusables.policies.translation, }) - } else if (router.locale) { - translationNotices.push({ - type: NotificationType.TRANSLATION, - content: t('notices.localization_complete'), - }) } } const releaseNotices: Array = [] diff --git a/data/ui.yml b/data/ui.yml index 93e3ccc73d..734de80bf1 100644 --- a/data/ui.yml +++ b/data/ui.yml @@ -8,10 +8,6 @@ header: release_candidate: # The version name is rendered before the below text via includes/header-notification.html ' is currently available as a release candidate. For more information, see "About upgrades to new releases."' - localization_complete: - We publish frequent updates to our documentation, and translation of this page may still be in progress. - For the most current information, please visit the - English documentation. early_access: 📣 Please do not share this URL publicly. This page contains content about an early access feature. release_notes_use_latest: Please use the latest release for the latest security, performance, and bug fixes. # GHES release notes diff --git a/src/landings/pages/product.tsx b/src/landings/pages/product.tsx index 1673a5223d..3467013927 100644 --- a/src/landings/pages/product.tsx +++ b/src/landings/pages/product.tsx @@ -5,7 +5,6 @@ import { useRouter } from 'next/router' // typically operating on elements **within** an article. import copyCode from 'components/lib/copy-code' import toggleAnnotation from 'components/lib/toggle-annotations' -import localization from 'components/lib/localization' import wrapCodeTerms from 'components/lib/wrap-code-terms' import { MainContextT, MainContext, getMainContext } from 'components/context/MainContext' @@ -40,7 +39,6 @@ import { useEffect } from 'react' function initiateArticleScripts() { copyCode() - localization() wrapCodeTerms() toggleAnnotation() } diff --git a/tests/fixtures/data/ui.yml b/tests/fixtures/data/ui.yml index 93e3ccc73d..734de80bf1 100644 --- a/tests/fixtures/data/ui.yml +++ b/tests/fixtures/data/ui.yml @@ -8,10 +8,6 @@ header: release_candidate: # The version name is rendered before the below text via includes/header-notification.html ' is currently available as a release candidate. For more information, see "About upgrades to new releases."' - localization_complete: - We publish frequent updates to our documentation, and translation of this page may still be in progress. - For the most current information, please visit the - English documentation. early_access: 📣 Please do not share this URL publicly. This page contains content about an early access feature. release_notes_use_latest: Please use the latest release for the latest security, performance, and bug fixes. # GHES release notes diff --git a/tests/rendering-fixtures/playwright-rendering.spec.ts b/tests/rendering-fixtures/playwright-rendering.spec.ts index e16976be16..2dfcb948b4 100644 --- a/tests/rendering-fixtures/playwright-rendering.spec.ts +++ b/tests/rendering-fixtures/playwright-rendering.spec.ts @@ -456,13 +456,6 @@ test.describe('translations', () => { await expect(page.getByRole('heading', { name: '日本 GitHub Docs' })).toBeVisible() }) - test('switch to English from Japanese using banner on home page', async ({ page }) => { - await page.goto('/ja') - await page.getByRole('link', { name: 'English documentation' }).click() - await expect(page).toHaveURL('/en') - await expect(page.getByRole('heading', { name: 'GitHub Docs' })).toBeVisible() - }) - test('switch to Japanese from English using widget on home page', async ({ page }) => { await page.goto('/en') await page.getByRole('button', { name: 'Select language: current language is English' }).click() @@ -475,14 +468,6 @@ test.describe('translations', () => { await expect(page).toHaveURL('/ja') }) - test('switch to English from Japanese using banner on article', async ({ page }) => { - await page.goto('/ja/get-started/quickstart/hello-world') - await expect(page.getByRole('heading', { name: 'こんにちは World' })).toBeVisible() - await page.getByRole('link', { name: 'English documentation' }).click() - await expect(page).toHaveURL('/en/get-started/quickstart/hello-world') - await expect(page.getByRole('heading', { name: 'Hello World' })).toBeVisible() - }) - test('switch to Japanese from English using widget on article', async ({ page }) => { await page.goto('/get-started/quickstart/hello-world') await page.getByRole('button', { name: 'Select language: current language is English' }).click() diff --git a/tests/rendering-fixtures/translations.js b/tests/rendering-fixtures/translations.js index e5d35a8c32..6cb681bcaa 100644 --- a/tests/rendering-fixtures/translations.js +++ b/tests/rendering-fixtures/translations.js @@ -16,13 +16,6 @@ describe('translations', () => { // You gotta know your tests/fixtures/translations/ja-jp/data/ui.yml expect(h1).toBe('日本 GitHub Docs') - // The header banner mentions something about - // "For the most up-to-date content, see the English version." - const notification = $('[data-testid="header-notification"]') - expect(notification.length).toBe(1) - const toEnglishDoc = notification.find('a#to-english-doc') - expect(toEnglishDoc.text()).toBe('English documentation') - // Sidebar uses the translated shortTitle const links = $('[data-testid=sidebar] a[href]') const hrefs = links