0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-11 02:59:07 +08:00
discourse/app/views/layouts
David Taylor d7de0f6735
DEV: Refactor locale bundle loading (#37114)
Previously, locale bundles were using `require()` directly, and were
very sensitive to load order. This made it very hard to refactor things,
especially for our upcoming move to Vite.

This commit updates the four types of locale bundle to contain only very
simple JS code, with no dependencies at the top level. They simply add
POJO and functions to the `window._discourse_locale_data` global. When
`discourse-i18n` is loaded, it checks that global, loads up the data,
and executes the functions (passing in any dependencies like
messageformat/runtime where required).

Changes in the HTML files are to bring the locale bundles up to the
first position, since they no longer have any dependencies, and we need
to be 100% sure they're loaded before discourse-i18n.

Tests are updated for the new bundle format, and the most complex ones
have been converted to system specs, so that we no longer need to create
a mock environment for executing messageformat/discourse-i18n/etc.

`lib/deprecated` changes (and associated pretty-text changes) are to
make the dependencies more formalized, because `require()` is subject to
race conditions, which started being hit following the locale refactor.

---------

Co-authored-by: Jarek Radosz <jradosz@gmail.com>
2026-01-16 11:45:14 +00:00
..
_head.html.erb FEATURE: Add page view tracking event (#36899) 2026-01-07 09:22:19 +08:00
_noscript_footer.html.erb UX: Rename FAQ to Guidelines (#27451) 2024-06-13 12:09:53 -03:00
_noscript_header.html.erb DEV: Add site description to crawler homepage view (#32845) 2025-05-22 08:33:59 +10:00
application.html.erb DEV: Refactor locale bundle loading (#37114) 2026-01-16 11:45:14 +00:00
crawler.html.erb FEATURE: Append locale to links in crawler view if present (#34466) 2025-08-22 08:46:33 +08:00
email_template.html.erb UX: add preview to email templates (#36657) 2026-01-08 11:33:53 +04:00
embed.html.erb DEV: Replace break_string.js with CSS in embedded view (#32488) 2025-04-28 10:47:27 +01:00
ember_cli.html.erb DEV: Stop using sprockets for 'use ember cli' stylesheet (#28633) 2024-08-29 10:38:27 +01:00
finish_installation.html.erb DEV: Allow new instances to be set up directly with Discourse ID (#36731) 2025-12-23 12:13:36 -05:00
no_ember.html.erb FEATURE: Add experimental tracking of 'real browser' pageviews (#26647) 2024-04-25 11:00:01 +01:00
publish.html.erb FEATURE: support adobe analytics tags tracking (#30433) 2024-12-26 15:25:48 +05:30