Skip to content

Commit

Permalink
Revert "Removed i18n toggle from labs UI (#21927)"
Browse files Browse the repository at this point in the history
This reverts commit fab5544.
  • Loading branch information
kevinansfield committed Dec 19, 2024
1 parent 9082a9f commit 9602c93
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ const BetaFeatures: React.FC = () => {
action={<FeatureToggle flag="additionalPaymentMethods" />}
detail={<>Enable support for CashApp, iDEAL, Bancontact, and others. <a className='text-green' href="https://ghost.org/help/payment-methods" rel="noopener noreferrer" target="_blank">Learn more &rarr;</a></>}
title='Additional payment methods' />
<LabItem
action={<FeatureToggle flag='i18n' />}
detail={<>Translate your membership flows into your publication language (<a className='text-green' href="https://github.com/TryGhost/Ghost/tree/main/ghost/i18n/locales" rel="noopener noreferrer" target="_blank">supported languages</a>). Don’t see yours? <a className='text-green' href="https://forum.ghost.org/t/help-translate-ghost-beta/37461" rel="noopener noreferrer" target="_blank">Get involved</a></>}
title='Portal translation' />
<LabItem
action={<div className='flex flex-col items-end gap-1'>
<FileUpload
Expand Down
25 changes: 12 additions & 13 deletions ghost/core/test/e2e-browser/admin/i18n.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,21 @@ const {createPostDraft} = require('../utils');
* @param {import('@playwright/test').Page} page
*/

async function setLanguage(sharedPage, language) {
await sharedPage.goto('/ghost/#/settings/publication-language');
const section = sharedPage.getByTestId('publication-language');
await section.getByRole('button', {name: 'Edit'}).click();
const input = section.getByPlaceholder('Site language');
await input.fill(language);
await section.getByRole('button', {name: 'Save'}).click();
}

test.describe('i18n', () => {
test.describe('Newsletter', () => {
test('changing the site language immediately translates strings in newsletters', async ({sharedPage}) => {
await setLanguage(sharedPage, 'fr');
await sharedPage.goto('/ghost/#/settings/publication-language');
const section = sharedPage.getByTestId('publication-language');
await section.getByRole('button', {name: 'Edit'}).click();
const input = section.getByPlaceholder('Site language');
await input.fill('fr');
await section.getByRole('button', {name: 'Save'}).click();

const labsSection = sharedPage.getByTestId('labs');
await labsSection.getByRole('button', {name: 'Open'}).click();
let portalLabel = labsSection.getByText('Portal translation');
let portalToggle = portalLabel.locator('..').locator('..').locator('..').getByRole('switch');
await portalToggle.click();

const postData = {
title: 'Publish and email post',
Expand All @@ -39,9 +41,6 @@ test.describe('i18n', () => {
const metaText = await sharedPage.frameLocator('iframe.gh-pe-iframe').locator('td.post-meta').first().textContent();
expect(metaText).toContain('Par Joe Bloggs');
expect(metaText).not.toContain('By Joe Bloggs');

// Set the language back before the next test!
await setLanguage(sharedPage, 'en');
});
});
});

0 comments on commit 9602c93

Please sign in to comment.