Skip to content

Commit

Permalink
feat: add next app with cookies based localization
Browse files Browse the repository at this point in the history
  • Loading branch information
stepan662 committed Oct 24, 2024
1 parent fc6cc84 commit 19ca60c
Show file tree
Hide file tree
Showing 35 changed files with 1,291 additions and 184 deletions.
36 changes: 36 additions & 0 deletions e2e/cypress/e2e/next-app-cookies/dev.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { exampleAppTest } from '../../common/exampleAppTest';
import { translationMethodsTest } from '../../common/translationMethodsTest';
import { exampleAppDevTest } from '../../common/exampleAppDevTest';

context('Next with app router in dev mode', { retries: 5 }, () => {
const url = 'http://localhost:8125';
const translationMethods = url + '/translation-methods';
exampleAppTest(url);
translationMethodsTest(translationMethods, {
en: [
{ text: 'This is a key', count: 2 },
{ text: 'This is key with params value value2', count: 6 },
{
text: 'This is a key with tags bold value',
count: 2,
testId: 'translationWithTags',
},
{ text: 'Translation in translation', count: 2 },
],
de: [
{ text: 'Dies ist ein Schlüssel', count: 2 },
{
text: 'Dies ist ein Schlüssel mit den Parametern value value2',
count: 6,
},
{
text: 'Dies ist ein Schlüssel mit den Tags bold value',
count: 2,
testId: 'translationWithTags',
},
{ text: 'Translation in translation', count: 2 },
],
});

exampleAppDevTest(url, { noLoading: true });
});
33 changes: 33 additions & 0 deletions e2e/cypress/e2e/next-app-cookies/prod.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { exampleAppTest } from '../../common/exampleAppTest';
import { translationMethodsTest } from '../../common/translationMethodsTest';

context('Next with app router in prod mode', () => {
const url = 'http://localhost:8127';
const translationMethods = url + '/translation-methods';
exampleAppTest(url);
translationMethodsTest(translationMethods, {
en: [
{ text: 'This is a key', count: 2 },
{ text: 'This is key with params value value2', count: 6 },
{
text: 'This is a key with tags bold value',
count: 2,
testId: 'translationWithTags',
},
{ text: 'Translation in translation', count: 2 },
],
de: [
{ text: 'Dies ist ein Schlüssel', count: 2 },
{
text: 'Dies ist ein Schlüssel mit den Parametern value value2',
count: 6,
},
{
text: 'Dies ist ein Schlüssel mit den Tags bold value',
count: 2,
testId: 'translationWithTags',
},
{ text: 'Translation in translation', count: 2 },
],
});
});
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"develop:react-i18next": "npm run develop -- --scope=@tolgee/react-i18next-testapp",
"develop:vue-i18next": "npm run develop -- --scope=@tolgee/vue-i18next-testapp",
"develop:next-app": "npm run develop -- --scope=@tolgee/next-app-testapp",
"develop:next-app-cookies": "npm run develop -- --scope=@tolgee/next-app-cookies-testapp",
"develop:vue-ssr": "npm run develop -- --scope=@tolgee/vue-ssr-testapp",
"build:e2e": "turbo run build:e2e --cache-dir='.turbo'",
"test:e2e": "pnpm run build:e2e && pnpm --prefix e2e run start",
Expand Down
Loading

0 comments on commit 19ca60c

Please sign in to comment.