Skip to content

Commit

Permalink
FIX: Correctly defer loading of admin locale (#45)
Browse files Browse the repository at this point in the history
Core recently added the `defer` attribute to all scripts. We need to apply the same here, so that the locale is loaded after the other core JS files. Using the `preload_script_url` helper will match the core behavior, and automatically includes the `defer` attribute.
  • Loading branch information
davidtaylorhq committed Jul 6, 2022
1 parent c5df6e5 commit a0a2759
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion plugin.rb
Expand Up @@ -21,7 +21,7 @@
# We're re-using a lot of locale strings from the admin section
# so we need to load it for non-staff users.
register_html_builder('server:before-head-close') do |ctx|
"<script src='#{ExtraLocalesController.url('admin')}'></script>" +
ctx.helpers.preload_script_url ExtraLocalesController.url('admin') +
ctx.helpers.preload_script('admin') +
ctx.helpers.discourse_stylesheet_link_tag(:admin)
end
Expand Down

0 comments on commit a0a2759

Please sign in to comment.