Skip to content
Snippets Groups Projects
Commit 939469cd authored by Bob Van Landuyt's avatar Bob Van Landuyt
Browse files

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.
parent f69b5468
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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
Loading
Loading
@@ -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"
Loading
Loading
---
title: Correctly render asset path for locales with a region
merge_request: 14924
author:
type: fixed
Loading
Loading
@@ -309,4 +309,12 @@ describe ApplicationHelper do
end
end
end
describe '#locale_path' do
it 'returns the locale path with an `_`' do
Gitlab::I18n.locale = 'pt-BR'
expect(helper.locale_path).to include('assets/locale/pt_BR/app')
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment