summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2017-10-18 10:29:18 +0200
committerBob Van Landuyt <bob@vanlanduyt.co>2017-10-18 13:10:35 +0200
commit939469cda3aa66e5cc68b6780f6ee8a8d6152d0f (patch)
treefb3639c1f23922bf073479f591ad3c52ecdba206 /app
parentf69b54682fc1770a73c528032b1a86f3e7d547a1 (diff)
downloadgitlab-ce-939469cda3aa66e5cc68b6780f6ee8a8d6152d0f.tar.gz
Build the locale path with an `_` instead of a `-`
The locale code is turned into an asset path with an underscore instead of a dash. The language codes are transformed by `I18n.locale` into a code with a dash. But the resources for translating are always stored in a path using a `_` separating the language and the region code.
Diffstat (limited to 'app')
-rw-r--r--app/helpers/application_helper.rb4
-rw-r--r--app/views/layouts/_head.html.haml2
2 files changed, 5 insertions, 1 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 8d02d5de5c3..4754a67450f 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -309,4 +309,8 @@ module ApplicationHelper
def show_new_repo?
cookies["new_repo"] == "true" && body_data_page != 'projects:show'
end
+
+ def locale_path
+ asset_path("locale/#{Gitlab::I18n.locale}/app.js")
+ end
end
diff --git a/app/views/layouts/_head.html.haml b/app/views/layouts/_head.html.haml
index f1b32274664..1597621fa78 100644
--- a/app/views/layouts/_head.html.haml
+++ b/app/views/layouts/_head.html.haml
@@ -37,7 +37,7 @@
- if content_for?(:library_javascripts)
= yield :library_javascripts
- = javascript_include_tag asset_path("locale/#{I18n.locale.to_s || I18n.default_locale.to_s}/app.js") unless I18n.locale == :en
+ = javascript_include_tag locale_path unless I18n.locale == :en
= webpack_bundle_tag "webpack_runtime"
= webpack_bundle_tag "common"
= webpack_bundle_tag "main"