Skip to content

Fix downloading all languages #528

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

Merged

Conversation

jakob-info
Copy link
Contributor

Partially fixes #525. The changes dynamically import the language. The current method loads the language when the application is ready to display the ui. With the new approach that is too late to start downloading the language js file. Thats why i call the method in initClientApp().

This improves performance, but further optimization is possible. Currently, my changes don't affect the existing dynamicActivationLocale() call because I'm unsure of the impact of setLoaded(). We're also downloading a large index.js file, which then triggers numerous imports. This forces the browser to wait for the initial file before discovering and requesting other necessary files, such as the language file.
To address this, we should flatten the dependency structure. Instead of a single <script> tag in index.html, we should have multiple. For example, since the browser sends preferred languages in its headers, we could handle language lookup server-side, eliminating the need to download JavaScript for this purpose and then import a language file in the browser.

You can modify the changes as you like. The key part is
const module = (await import(`./locales/${locale}.po`)); i18n.load(locale, module.messages);

Checklist

  • I have read the contributing guidelines.
  • My code is of good quality and follows the coding standards of the project.
  • I have tested my changes, and they work as expected.

Thank you for your contribution! 🎉

@daveearley
Copy link
Contributor

Nice! Thank you. I'll test this later this evening

@daveearley daveearley merged commit 5b23b0a into HiEventsDev:develop May 6, 2025
1 check passed
@github-actions github-actions bot locked and limited conversation to collaborators May 6, 2025
@daveearley
Copy link
Contributor

Looks good! Thanks again

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

Successfully merging this pull request may close these issues.

🐛Poor SEO performance of public event page
2 participants