-
Notifications
You must be signed in to change notification settings - Fork 159
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
Init custom translations #8790
Init custom translations #8790
Conversation
Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes. |
packages/web-runtime/src/index.ts
Outdated
@@ -60,8 +62,31 @@ export const bootstrapApp = async (configurationPath: string): Promise<void> => | |||
}) | |||
const themePromise = announceTheme({ store, app, designSystem, runtimeConfiguration }) | |||
await Promise.all([applicationsPromise, themePromise]) | |||
const customTranslations = {} | |||
|
|||
for (const customTranslation of configurationManager.customTranslations) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please move fetching and collecting/merging the custom translations into its own method? Something like fetchCustomTranslations
which then returns the customTranslations
object. Otherwise this is an abstraction level mismatch. All the other code in this bootstrapApp
method is on a higher abstraction level.
I already went ahead and added I needed the |
packages/web-runtime/src/index.ts
Outdated
@@ -60,8 +63,13 @@ export const bootstrapApp = async (configurationPath: string): Promise<void> => | |||
}) | |||
const themePromise = announceTheme({ store, app, designSystem, runtimeConfiguration }) | |||
await Promise.all([applicationsPromise, themePromise]) | |||
const customTranslations = await loadCustomTranslations({ configurationManager }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last nitpick: tiny performance improvement possible by splitting this into promise creation and awaiting the resolved promise together with other promises. This is a good thing because the promise execution starts immediately with creation, so this enables parallel processing instead of awaiting promises sequentially.
In other words:
Please split this line into:
const customTranslationsPromise = loadCustomTranslations({ configurationManager })
for promise creation and add that to the Promise.all
. You can access the resolved custom translations like this:
const [customTranslations] = await Promise.all([customTranslationsPromise, applicationsPromise, themePromise])
Linter complains :-) |
SonarCloud Quality Gate failed. |
Description
Related Issue
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist:
Open tasks: