diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb
index 2f33b6c..30fa63a 100644
--- a/app/controllers/pages_controller.rb
+++ b/app/controllers/pages_controller.rb
@@ -89,13 +89,7 @@ class PagesController < ApplicationController
end
impressionist(page)
- final_page = render_final_page("#{module_app}/#{params[:target_action]}",page,layout)
- if session[:zh_cn]
- final_page = ZhConv.convert("zh-cn", final_page)
- final_page.gsub!('/zh_tw/','/zh_cn/')
- final_page.sub!('繁体中文','繁体中文')
- end
- render :html => final_page.html_safe
+ render :html => render_final_page("#{module_app}/#{params[:target_action]}",page,layout).html_safe
else
render :file => "#{Rails.root}/public/404.html", :layout => false, :status => :not_found
end
@@ -227,6 +221,7 @@ class PagesController < ApplicationController
end
def render_final_page(original_view=get_view,page,layout)
+ final_html_for_render = ""
if layout
parts = $mobile.blank? ? (page.page_parts rescue []) : (page.mobile_page_parts rescue [])
@@ -282,11 +277,13 @@ class PagesController < ApplicationController
end
link = doc.css("link")[0]
link.attributes["href"].value = current_site.favicon.url.nil? ? "/assets/favicon.ico" : current_site.favicon.url
- doc.to_html
+ final_html_for_render = doc.to_html
else
- render_to_string(original_view)
+ final_html_for_render = render_to_string(original_view)
end
+ final_html_for_render = change_to_language(final_html_for_render)
+ final_html_for_render
end
def get_widget_path(widget)
@@ -350,4 +347,14 @@ class PagesController < ApplicationController
end
end
+ private
+ def change_to_language(final_html)
+ if session[:zh_cn]
+ final_html = ZhConv.convert("zh-cn", final_html)
+ final_html.gsub!('/zh_tw/','/zh_cn/')
+ final_html.sub!('繁体中文','繁体中文')
+ end
+ final_html
+ end
+
end