Skip to content

Commit

Permalink
Merge branch 'bvl-fix-locale-path' into 'master'
Browse files Browse the repository at this point in the history
Render region codes for locale assets with an `_` instead of a `-`

Closes #39225

See merge request gitlab-org/gitlab-ce!14924
  • Loading branch information
Tim Zallmann committed Oct 18, 2017
2 parents 852f6f7 + 939469c commit 4733570
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -309,4 +309,8 @@ def collapsed_sidebar?
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
2 changes: 1 addition & 1 deletion app/views/layouts/_head.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions changelogs/unreleased/bvl-fix-locale-path.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Correctly render asset path for locales with a region
merge_request: 14924
author:
type: fixed
8 changes: 8 additions & 0 deletions spec/helpers/application_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -309,4 +309,12 @@ def element(*arguments)
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 comments on commit 4733570

Please sign in to comment.