Merge branch 'bvl-fix-locale-path' into 'master'

Render region codes for locale assets with an `_` instead of a `-`

Closes #39225

See merge request gitlab-org/gitlab-ce!14924
This commit is contained in:
Tim Zallmann 2017-10-18 12:37:11 +00:00
commit 4733570c3d
4 changed files with 18 additions and 1 deletions

View file

@ -309,4 +309,8 @@ module ApplicationHelper
def show_new_repo? def show_new_repo?
cookies["new_repo"] == "true" && body_data_page != 'projects:show' cookies["new_repo"] == "true" && body_data_page != 'projects:show'
end end
def locale_path
asset_path("locale/#{Gitlab::I18n.locale}/app.js")
end
end end

View file

@ -37,7 +37,7 @@
- if content_for?(:library_javascripts) - if content_for?(:library_javascripts)
= yield :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 "webpack_runtime"
= webpack_bundle_tag "common" = webpack_bundle_tag "common"
= webpack_bundle_tag "main" = webpack_bundle_tag "main"

View file

@ -0,0 +1,5 @@
---
title: Correctly render asset path for locales with a region
merge_request: 14924
author:
type: fixed

View file

@ -309,4 +309,12 @@ describe ApplicationHelper do
end end
end 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 end