Permalink
Browse files

Allow i18n strings for the systemwide tab when the tab_name looks lik…

…e a symbol.
  • Loading branch information...
1 parent e478d51 commit 6dd3b5b4911b32316781a18f5ca575e004bca132 @edavis10 edavis10 committed with jamtur01 Mar 30, 2009
Showing with 10 additions and 1 deletion.
  1. +10 −1 init.rb
View
11 init.rb
@@ -48,7 +48,16 @@
menu(:top_menu,
:tab,
{ :controller => 'tab', :action => 'system_show' },
- :caption => Proc.new { Setting.plugin_redmine_tab['system_tab_name'] },
+ :caption => Proc.new {
+ # Translate or return the system tab name directly
+ string = Setting.plugin_redmine_tab['system_tab_name']
+ if !string.blank? && string.match(/\A:/) # uses symbol syntax, :string
+ string.gsub!(':','')
+ string = GLoc.l(string.to_sym) if Object.const_defined?('GLoc') # Rails 2.1.x
+ string = I18n.t(string.to_sym) if Object.const_defined?('I18n') # Rails 2.2.x
+ end
+ string
+ },
:if => Proc.new { !Setting.plugin_redmine_tab['system_tab_name'].blank? })
end

0 comments on commit 6dd3b5b

Please sign in to comment.