0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2024-12-30 22:34:01 -05:00

Revert "Removed i18n toggle from labs UI (#21927)"

This reverts commit fab5544217.
This commit is contained in:
Kevin Ansfield 2024-12-19 17:53:09 +00:00
parent 9082a9f1db
commit 9602c93448
2 changed files with 16 additions and 13 deletions

View file

@ -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>). Dont 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

View file

@ -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',
@ -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');
});
});
});