##// END OF EJS Templates
remove trailing white-spaces from lib/redmine/i18n.rb....
Toshi MARUYAMA -
r6819:87faf96f6ac2
parent child
Show More
@@ -3,7 +3,7 module Redmine
3 def self.included(base)
3 def self.included(base)
4 base.extend Redmine::I18n
4 base.extend Redmine::I18n
5 end
5 end
6
6
7 def l(*args)
7 def l(*args)
8 case args.size
8 case args.size
9 when 1
9 when 1
@@ -25,12 +25,12 module Redmine
25 k = "#{options[:prefix]}#{s}".to_sym
25 k = "#{options[:prefix]}#{s}".to_sym
26 ::I18n.t(k, :default => s.to_s.humanize)
26 ::I18n.t(k, :default => s.to_s.humanize)
27 end
27 end
28
28
29 def l_hours(hours)
29 def l_hours(hours)
30 hours = hours.to_f
30 hours = hours.to_f
31 l((hours < 2.0 ? :label_f_hour : :label_f_hour_plural), :value => ("%.2f" % hours.to_f))
31 l((hours < 2.0 ? :label_f_hour : :label_f_hour_plural), :value => ("%.2f" % hours.to_f))
32 end
32 end
33
33
34 def ll(lang, str, value=nil)
34 def ll(lang, str, value=nil)
35 ::I18n.t(str.to_s, :value => value, :locale => lang.to_s.gsub(%r{(.+)\-(.+)$}) { "#{$1}-#{$2.upcase}" })
35 ::I18n.t(str.to_s, :value => value, :locale => lang.to_s.gsub(%r{(.+)\-(.+)$}) { "#{$1}-#{$2.upcase}" })
36 end
36 end
@@ -39,7 +39,7 module Redmine
39 return nil unless date
39 return nil unless date
40 Setting.date_format.blank? ? ::I18n.l(date.to_date) : date.strftime(Setting.date_format)
40 Setting.date_format.blank? ? ::I18n.l(date.to_date) : date.strftime(Setting.date_format)
41 end
41 end
42
42
43 def format_time(time, include_date = true)
43 def format_time(time, include_date = true)
44 return nil unless time
44 return nil unless time
45 time = time.to_time if time.is_a?(String)
45 time = time.to_time if time.is_a?(String)
@@ -52,7 +52,7 module Redmine
52 def day_name(day)
52 def day_name(day)
53 ::I18n.t('date.day_names')[day % 7]
53 ::I18n.t('date.day_names')[day % 7]
54 end
54 end
55
55
56 def month_name(month)
56 def month_name(month)
57 ::I18n.t('date.month_names')[month]
57 ::I18n.t('date.month_names')[month]
58 end
58 end
@@ -65,13 +65,13 module Redmine
65 @@languages_lookup = valid_languages.inject({}) {|k, v| k[v.to_s.downcase] = v; k }
65 @@languages_lookup = valid_languages.inject({}) {|k, v| k[v.to_s.downcase] = v; k }
66 @@languages_lookup[lang.to_s.downcase]
66 @@languages_lookup[lang.to_s.downcase]
67 end
67 end
68
68
69 def set_language_if_valid(lang)
69 def set_language_if_valid(lang)
70 if l = find_language(lang)
70 if l = find_language(lang)
71 ::I18n.locale = l
71 ::I18n.locale = l
72 end
72 end
73 end
73 end
74
74
75 def current_language
75 def current_language
76 ::I18n.locale
76 ::I18n.locale
77 end
77 end
General Comments 0
You need to be logged in to leave comments. Login now