Permalink
Browse files

js admin locale unification; fix #1857

  • Loading branch information...
1 parent b900c61 commit a4a3a5876bbb596aaffd155b273d03f03d373dee @keram keram committed with parndt Sep 1, 2012
@@ -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);
WYMeditor.editor.prototype.loadIframe = function(iframe) {
@@ -323,7 +323,7 @@ $.fn.wymeditor = function(options) {
initSkin: true,
loadSkin: true,
- lang: "en",
+ lang: refinery.current_admin_locale,
direction: "ltr",
@@ -1,4 +1,9 @@
module Refinery
module AdminHelper
+
+ def current_admin_locale
+ ::Refinery.current_admin_locale
+ end
+
end
end
@@ -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 '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 -%>
<% custom_javascripts.each do |js| %>
<%= javascript_include_tag js %>
@@ -114,6 +114,10 @@ def i18n_enabled?
::Refinery::I18n.enabled?
end
+ def current_admin_locale
+ ::I18n.locale
+ end
+
# Returns a Pathname to the root of the Refinery CMS project
def root
@root ||= Pathname.new(File.expand_path('../../../../', __FILE__))

0 comments on commit a4a3a58

Please sign in to comment.