Skip to content

Commit

Permalink
rename test-setup-config.js to test-setup-config.jsx (#6133)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomschall authored Jun 28, 2024
1 parent e4b1b22 commit 3c56a14
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 13 deletions.
2 changes: 1 addition & 1 deletion apps/plone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
},
"setupFiles": [
"@plone/volto/test-setup-globals.js",
"@plone/volto/test-setup-config.js"
"@plone/volto/test-setup-config.jsx"
],
"globals": {
"__DEV__": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
},
"setupFiles": [
"@plone/volto/test-setup-globals.js",
"@plone/volto/test-setup-config.js"
"@plone/volto/test-setup-config.jsx"
],
"globals": {
"__DEV__": true
Expand Down
1 change: 1 addition & 0 deletions packages/generator-volto/news/6133.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Rename test-setup-config.js to test-setup-config.jsx, otherwise jest tests will eventually fail @tomschall
1 change: 1 addition & 0 deletions packages/volto/news/6133.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Whitelist some dynamic imports to suppress vite warnings in storybook @tomschall
4 changes: 3 additions & 1 deletion packages/volto/src/components/manage/Add/Add.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,9 @@ class Add extends Component {
if (this.props.location?.state?.translationOf) {
const language = this.props.location.state.languageFrom;
const langFileName = toGettextLang(language);
import('@root/../locales/' + langFileName + '.json').then((locale) => {
import(
/* @vite-ignore */ '@root/../locales/' + langFileName + '.json'
).then((locale) => {
this.props.changeLanguage(language, locale.default);
});
this.props.history.push(this.props.location?.state?.translationOf);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ const CreateTranslation = (props) => {
// We change the interface language
if (config.settings.supportedLanguages.includes(language)) {
const langFileName = toGettextLang(language);
import('@root/../locales/' + langFileName + '.json').then((locale) => {
import(
/* @vite-ignore */ '@root/../locales/' + langFileName + '.json'
).then((locale) => {
dispatch(changeLanguage(language, locale.default));
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ const TranslationObject = ({
let lang =
config.settings.supportedLanguages[Object.keys(locales).length];
const langFileName = toGettextLang(lang);
import('@root/../locales/' + langFileName + '.json').then((locale) => {
import(
/* @vite-ignore */ '@root/../locales/' + langFileName + '.json'
).then((locale) => {
setLocales({ ...locales, [toReactIntlLang(lang)]: locale.default });
setLoadingLocale(false);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ class PersonalPreferences extends Component {
let language = data.language || 'en';
if (config.settings.supportedLanguages.includes(language)) {
const langFileName = toGettextLang(language);
import('@root/../locales/' + langFileName + '.json').then((locale) => {
import(
/* @vite-ignore */ '@root/../locales/' + langFileName + '.json'
).then((locale) => {
this.props.changeLanguage(language, locale.default);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ const MultilingualRedirector = (props) => {
let mounted = true;
if (settings.isMultilingual && pathname === '/') {
const langFileName = toGettextLang(redirectToLanguage);
import('@root/../locales/' + langFileName + '.json').then((locale) => {
import(
/* @vite-ignore */ '@root/../locales/' + langFileName + '.json'
).then((locale) => {
if (mounted) {
dispatch(changeLanguage(redirectToLanguage, locale.default));
}
Expand Down
10 changes: 5 additions & 5 deletions packages/volto/src/middleware/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,11 @@ const apiMiddlewareFactory =
config.settings.supportedLanguages.includes(lang)
) {
const langFileName = toGettextLang(lang);
import('@root/../locales/' + langFileName + '.json').then(
(locale) => {
dispatch(changeLanguage(lang, locale.default));
},
);
import(
/* @vite-ignore */ '@root/../locales/' + langFileName + '.json'
).then((locale) => {
dispatch(changeLanguage(lang, locale.default));
});
}
}
if (type === LOGIN && settings.websockets) {
Expand Down
4 changes: 3 additions & 1 deletion packages/volto/src/server.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ let locales = {};
if (config.settings) {
config.settings.supportedLanguages.forEach((lang) => {
const langFileName = toGettextLang(lang);
import('@root/../locales/' + langFileName + '.json').then((locale) => {
import(
/* @vite-ignore */ '@root/../locales/' + langFileName + '.json'
).then((locale) => {
locales = { ...locales, [toReactIntlLang(lang)]: locale.default };
});
});
Expand Down

0 comments on commit 3c56a14

Please sign in to comment.