ref: refs/heads/network
commit b90a85b4f399686ecb9bae5a527ac43a06307afb
Author: Stefan Schubert
Date: Tue Sep 15 15:03:46 2009 +0200
setting translation language; currently without popup
---
.../app/controllers/controlpanel_controller.rb | 9 +++++++++
.../views/controlpanel/_select_language.html.erb | 4 ++++
webclient/app/views/layouts/main.rhtml | 3 +++
.../vendor/plugins/lang_helper/lib/lang_helper.rb | 10 +++++++++-
4 files changed, 25 insertions(+), 1 deletions(-)
diff --git a/webclient/app/controllers/controlpanel_controller.rb b/webclient/app/controllers/controlpanel_controller.rb
index 9bdc540..289c9f4 100644
--- a/webclient/app/controllers/controlpanel_controller.rb
+++ b/webclient/app/controllers/controlpanel_controller.rb
@@ -26,6 +26,15 @@ class ControlpanelController < ApplicationController
end
end
+ # POST /controlpanel/select_language
+ # setting language for translations
+ def select_language
+ respond_to do |format|
+ format.html { render :partial => "select_language" }
+ end
+ end
+
+
# this action allows to retrieve the shortcuts
# as a resource
def shortcuts
diff --git a/webclient/app/views/controlpanel/_select_language.html.erb b/webclient/app/views/controlpanel/_select_language.html.erb
new file mode 100644
index 0000000..bb25355
--- /dev/null
+++ b/webclient/app/views/controlpanel/_select_language.html.erb
@@ -0,0 +1,4 @@
+
+<div class="language_selection">
+ <%= show_language %>
+</div>
diff --git a/webclient/app/views/layouts/main.rhtml b/webclient/app/views/layouts/main.rhtml
index 3a95328..d0c36eb 100644
--- a/webclient/app/views/layouts/main.rhtml
+++ b/webclient/app/views/layouts/main.rhtml
@@ -47,6 +47,8 @@
if host.blank? || user.blank? -%>
<% else -%>
<ul>
+ <li><%= link_to_remote ( image_tag(current_locale_image, :size => "16x11", :alt => "#{current_locale}"),
+ :update =>"language_selection", :url => { :controller => :controlpanel, :action => :select_language} ) %></li>
<li><strong><%=_("Connected Host")%></strong></li>
<li><%=_("Name:")%> <strong><%= host.name -%></strong></li>
<li><%=_("User:")%> <strong><%= user -%></strong></li>
@@ -62,6 +64,7 @@
<div id="content" class="content">
<!-- here both flash and dynamic notifications should be added -->
<div id="flash-messages">
+ <div id="language_selection">
<!-- show the flash messages -->
<% flash.each do |flash_type, message| %>
diff --git a/webclient/vendor/plugins/lang_helper/lib/lang_helper.rb b/webclient/vendor/plugins/lang_helper/lib/lang_helper.rb
index 41d3549..be00c06 100644
--- a/webclient/vendor/plugins/lang_helper/lib/lang_helper.rb
+++ b/webclient/vendor/plugins/lang_helper/lib/lang_helper.rb
@@ -10,6 +10,14 @@ module LangHelper
bindtextdomain("lang_helper",
:path => File.join(RAILS_ROOT, "vendor/plugins/lang_helper/locale"))
+ def current_locale_image
+ return "/images/flags/#{locale.language}.png"
+ end
+
+ def current_locale
+ locale.language
+ end
+
def show_language
langs = I18n.supported_locales.sort
ret = "<h4>" + _("Select locale") + "</h4>"
@@ -26,7 +34,7 @@ module LangHelper
def cookie_locale
cookies["lang"] = params["id"]
set_locale params["id"]
- flash[:notice] = _('Cookie "lang" is set: %s') % params["id"]
+# flash[:notice] = _('Cookie "lang" is set: %s') % params["id"]
redirect_to :action => 'index'
end
end
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org