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

Localize common characters (attempt 2) #212

Merged
merged 3 commits into from
Nov 20, 2024

Conversation

dlockhart
Copy link
Member

I had to quickly revert the first version of this as it broke a bunch of core unit tests. The reason for that is that the changes caused components wired up to use a static collection of resources (i.e. no importFunc) to stop working.

I'll add comments to call out the changes I made to work around this.

@dlockhart dlockhart force-pushed the GAUD-7171/localize-common-characters-v2 branch from 14177cf to 603a8a7 Compare November 18, 2024 21:19
@dlockhart dlockhart force-pushed the GAUD-7171/localize-common-characters-v2 branch from 603a8a7 to 2e716c4 Compare November 18, 2024 21:21
@@ -129,12 +158,25 @@ export const getLocalizeClass = (superclass = class {}) => class LocalizeClass e
const possibleLanguages = this._generatePossibleLanguages(config);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change 1: these lines were previously wrapped around an if (config.importFunc) { but components that define their own static resources by manually implementing getLocalizeResources were then not getting their resources filled in.

}
return Promise.all(resourcesLoadedPromises);
}

static async _getLocalizeResources(langs, { importFunc, osloCollection, useBrowserLangs }) {

if (importFunc === undefined) return;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change 2: the default implementation of getLocalizeResources just calls this, but importFunc can now be undefined. So we short-circuit and return undefined, but that's going to cause change 3 below...

lib/localize.js Outdated Show resolved Hide resolved
@dlockhart dlockhart marked this pull request as ready for review November 18, 2024 21:24
@dlockhart dlockhart requested a review from a team as a code owner November 18, 2024 21:24
@dlockhart dlockhart merged commit c57816b into main Nov 20, 2024
1 check passed
@dlockhart dlockhart deleted the GAUD-7171/localize-common-characters-v2 branch November 20, 2024 19:21
Copy link

🎉 This PR is included in version 3.21.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants