Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

js admin locale unification; fix #1857 #1920

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/app/assets/javascripts/refinery/boot_wym.js.erb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ var wymeditor_boot_options = $.extend({
); );
} }
} }
, lang: '<%= ::Refinery.i18n_enabled? ? ::Refinery::I18n.current_locale : 'en' %>' , lang: refinery.current_admin_locale
}, custom_wymeditor_boot_options); }, custom_wymeditor_boot_options);


WYMeditor.editor.prototype.loadIframe = function(iframe) { WYMeditor.editor.prototype.loadIframe = function(iframe) {
Expand Down
2 changes: 1 addition & 1 deletion core/app/assets/javascripts/wymeditor/setup.js.erb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ $.fn.wymeditor = function(options) {
initSkin: true, initSkin: true,
loadSkin: true, loadSkin: true,


lang: "en", lang: refinery.current_admin_locale,


direction: "ltr", direction: "ltr",


Expand Down
5 changes: 5 additions & 0 deletions core/app/helpers/refinery/admin_helper.rb
Original file line number Original file line Diff line number Diff line change
@@ -1,4 +1,9 @@
module Refinery module Refinery
module AdminHelper module AdminHelper

def current_admin_locale
::Refinery.current_admin_locale
end

end end
end end
6 changes: 5 additions & 1 deletion core/app/views/refinery/admin/_javascripts.html.erb
Original file line number Original file line Diff line number Diff line change
@@ -1,6 +1,10 @@
<script type="text/javascript" >
var refinery = window.refinery || {};
refinery.current_admin_locale = '<%= current_admin_locale %>';
</script>
<%= javascript_include_tag 'admin' -%> <%= javascript_include_tag 'admin' -%>
<%= javascript_include_tag 'refinery/refinery' -%> <%= javascript_include_tag 'refinery/refinery' -%>
<%= javascript_include_tag 'refinery/wymeditor', "wymeditor/lang/#{::I18n.locale}", "wymeditor/skins/refinery/skin" %> <%= javascript_include_tag 'refinery/wymeditor', "wymeditor/lang/#{current_admin_locale}", "wymeditor/skins/refinery/skin" %>
<%= yield :after_javascript_libraries -%> <%= yield :after_javascript_libraries -%>
<% custom_javascripts.each do |js| %> <% custom_javascripts.each do |js| %>
<%= javascript_include_tag js %> <%= javascript_include_tag js %>
Expand Down
4 changes: 4 additions & 0 deletions core/lib/refinery/core.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ def i18n_enabled?
::Refinery::I18n.enabled? ::Refinery::I18n.enabled?
end end


def current_admin_locale
::I18n.locale
end

# Returns a Pathname to the root of the Refinery CMS project # Returns a Pathname to the root of the Refinery CMS project
def root def root
@root ||= Pathname.new(File.expand_path('../../../../', __FILE__)) @root ||= Pathname.new(File.expand_path('../../../../', __FILE__))
Expand Down