Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

package: Update Vue i18n to version 10.x with custom fixes for breaking changes #575

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"swiper": "^11.0.0",
"toml": "^3.0.0",
"vue": "^3.0.0",
"vue-i18n": "^9.2.2",
"vue-i18n": "^10.0.0",
"vue-router": "^4.0.0",
"vuejs3-logger": "^1.0.0"
},
Expand Down
27 changes: 5 additions & 22 deletions src/components/__tests__/CountdownEvent.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,11 @@ describe('<CountdownEvent>', () => {
});

it('has translation for all strings', () => {
const translationKeyList = [
'index.countdown.title',
'index.countdown.days',
'index.countdown.hours',
'index.countdown.minutes',
'index.countdown.seconds',
];

translationKeyList.forEach((translationKey) => {
const defaultEnglishString = i18n.global.t(translationKey, 'en');

const locales = i18n.global.availableLocales;
locales
.filter((locale) => locale !== 'en')
.forEach((locale) => {
i18n.global.locale = locale;
const translatedString = i18n.global.t(translationKey);
cy.wrap(translatedString)
.should('be.a', 'string')
.and('not.equal', defaultEnglishString);
});
});
cy.testLanguageStringsInContext(
['title', 'days', 'hours', 'minutes', 'seconds'],
'index.countdown',
i18n,
);
});

it('displays internationalized labels', () => {
Expand Down
46 changes: 15 additions & 31 deletions src/components/__tests__/DrawerHeader.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,38 +23,22 @@ describe('<DrawerHeader>', () => {
});

it('has translation for all strings', () => {
const translationStrings = [
'titleStateDefault',
'titleStateContact',
'titleParticipants',
'titleCoordinators',
'titleGuide',
'buttonGuide',
'titleContact',
'buttonContact',
'titleLinks',
'titleSocials',
];

const translationKeyList = translationStrings.map(
(item) => `index.help.${item}`,
cy.testLanguageStringsInContext(
[
'titleStateDefault',
'titleStateContact',
'titleParticipants',
'titleCoordinators',
'titleGuide',
'buttonGuide',
'titleContact',
'buttonContact',
'titleLinks',
'titleSocials',
],
'index.help',
i18n,
);

translationKeyList.forEach((translationKey) => {
const defaultEnglishString = i18n.global.t(translationKey, 'en');

const locales = i18n.global.availableLocales;
locales
.filter((locale) => locale !== 'en')
.forEach((locale) => {
i18n.global.locale = locale;
const translatedString = i18n.global.t(translationKey);

cy.wrap(translatedString)
.should('be.a', 'string')
.and('not.equal', defaultEnglishString);
});
});
});

it('renders logo', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ labelCompanyShort = "Company"
labelConfirmBillingDetails = "I confirm that the billing information above is correct"
labelCoordinatorResponsibility = "I will arrange for the company to pay all or part of the entry fee for our employee team(s)."
labelDonorEntryFee = "My organisation would like to support AutoMat and pay a charity entry fee of 500 CZK excluding VAT per person"
labelEmail = "E-mail"
labelEmail = "Email"
labelFirstName = "First Name"
labelGender = "Gender"
labelHouseNumber = "House number"
Expand Down
14 changes: 12 additions & 2 deletions test/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,24 @@ Cypress.Commands.add(
);

translationKeyList.forEach((translationKey) => {
const defaultEnglishString = i18n.global.t(translationKey, 'en');
const defaultEnglishString = i18n.global.t(
translationKey,
{},
{ locale: 'en' },
);

const locales = i18n.global.availableLocales;
locales
.filter((locale) => locale !== 'en')
.forEach((locale) => {
// required for E2E tests to work
i18n.global.locale = locale;
const translatedString = i18n.global.t(translationKey);

const translatedString = i18n.global.t(
translationKey,
{},
{ locale: locale },
);

cy.wrap(translatedString)
.should('be.a', 'string')
Expand Down
42 changes: 21 additions & 21 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -486,26 +486,26 @@
resolved "https://registry.yarnpkg.com/@iarna/toml/-/toml-2.2.5.tgz#b32366c89b43c6f8cefbdefac778b9c828e3ba8c"
integrity sha512-trnsAYxU3xnS1gPHPyU961coFyLkh4gAD/0zQ5mymY4yOZ+CYvsPqUbOFSw0aDM4y0tV7tiFxL/1XfXPNC6IPg==

"@intlify/core-base@9.14.0":
version "9.14.0"
resolved "https://registry.yarnpkg.com/@intlify/core-base/-/core-base-9.14.0.tgz#63ce687a6560c0af6a16cb567d9d8a1ea1a5a65e"
integrity sha512-zJn0imh9HIsZZUtt9v8T16PeVstPv6bP2YzlrYJwoF8F30gs4brZBwW2KK6EI5WYKFi3NeqX6+UU4gniz5TkGg==
"@intlify/core-base@10.0.1":
version "10.0.1"
resolved "https://registry.yarnpkg.com/@intlify/core-base/-/core-base-10.0.1.tgz#18ecddcd4ad2f67c0dccb7b72e60036b7b4434d0"
integrity sha512-6kpRGjhos95ph7QmEtP4tnWFTW102s71CLQAQwfsIGqOAcoJhzcYFpzIQ0gKXzqAIXsMD/hwM5qJ4ewqMHw3gg==
dependencies:
"@intlify/message-compiler" "9.14.0"
"@intlify/shared" "9.14.0"
"@intlify/message-compiler" "10.0.1"
"@intlify/shared" "10.0.1"

"@intlify/message-compiler@9.14.0":
version "9.14.0"
resolved "https://registry.yarnpkg.com/@intlify/message-compiler/-/message-compiler-9.14.0.tgz#e767141dd12862b3c1bf02ab5fc4852792812381"
integrity sha512-sXNsoMI0YsipSXW8SR75drmVK56tnJHoYbPXUv2Cf9lz6FzvwsosFm6JtC1oQZI/kU+n7qx0qRrEWkeYFTgETA==
"@intlify/message-compiler@10.0.1":
version "10.0.1"
resolved "https://registry.yarnpkg.com/@intlify/message-compiler/-/message-compiler-10.0.1.tgz#2cd25944ffece4312e4dbdd2ebf9556176aaed90"
integrity sha512-fPeykrcgVT5eOIlshTHiPCN8FV3AZyBOdMS3XaXzfQ6eL5wqfc29I/EdIv5YXVW5X8e/BgYeWjBC0Cuznsl/2g==
dependencies:
"@intlify/shared" "9.14.0"
"@intlify/shared" "10.0.1"
source-map-js "^1.0.2"

"@intlify/shared@9.14.0":
version "9.14.0"
resolved "https://registry.yarnpkg.com/@intlify/shared/-/shared-9.14.0.tgz#e8fb3693ad4171442cbe6cb8922a9b5a22ffb4ef"
integrity sha512-r+N8KRQL7LgN1TMTs1A2svfuAU0J94Wu9wWdJVJqYsoMMLIeJxrPjazihfHpmJqfgZq0ah3Y9Q4pgWV2O90Fyg==
"@intlify/shared@10.0.1":
version "10.0.1"
resolved "https://registry.yarnpkg.com/@intlify/shared/-/shared-10.0.1.tgz#427586698d07a8658560afff1fe55c6d134207b9"
integrity sha512-b4h7IWdZl710DnAhET8lgfgZ4Y9A2IZx/gbli3Ec/zHtYCoPqLHmiM7kUNBrSZj7d/SSjcMMZHuz5I09x3PYZw==

"@istanbuljs/load-nyc-config@^1.0.0", "@istanbuljs/load-nyc-config@^1.1.0":
version "1.1.0"
Expand Down Expand Up @@ -6124,13 +6124,13 @@ vue-eslint-parser@^9.4.3:
lodash "^4.17.21"
semver "^7.3.6"

vue-i18n@^9.2.2:
version "9.14.0"
resolved "https://registry.yarnpkg.com/vue-i18n/-/vue-i18n-9.14.0.tgz#d6f1b3d95bfc4f40e630ff9456c78ab5becfd933"
integrity sha512-LxmpRuCt2rI8gqU+kxeflRZMQn4D5+4M3oP3PWZdowW/ePJraHqhF7p4CuaME52mUxdw3Mmy2yAUKgfZYgCRjA==
vue-i18n@^10.0.0:
version "10.0.1"
resolved "https://registry.yarnpkg.com/vue-i18n/-/vue-i18n-10.0.1.tgz#5c67257f01dc9133513405985121fc86bbd2df84"
integrity sha512-SQVlSm/1S6AaG1wexvwq3ebXUrrkx75ZHD78UAs4/rYD/X3tsQxfm6ElpT4ZPegJQEgRtOJjGripqSrfqAENtg==
dependencies:
"@intlify/core-base" "9.14.0"
"@intlify/shared" "9.14.0"
"@intlify/core-base" "10.0.1"
"@intlify/shared" "10.0.1"
"@vue/devtools-api" "^6.5.0"

vue-router@^4.0.0:
Expand Down
Loading