]> git.openstreetmap.org Git - rails.git/blob - vendor/plugins/globalize2/lib/globalize/translation.rb
Allow the "remember me" label to wrap when showing OpenID URL field
[rails.git] / vendor / plugins / globalize2 / lib / globalize / translation.rb
1 module Globalize
2   # Translations are simple value objects that carry some context information
3   # alongside the actual translation string.
4
5   class Translation < String
6     class Attribute < Translation
7       attr_accessor :requested_locale, :locale, :key
8     end
9     
10     class Static < Translation
11       attr_accessor :requested_locale, :locale, :key, :options, :plural_key, :original
12       
13       def initialize(string, meta = nil)
14         self.original = string
15         super
16       end
17     end
18     
19     def initialize(string, meta = nil)
20       set_meta meta
21       super string
22     end
23   
24     def fallback?
25       locale.to_sym != requested_locale.to_sym
26     end
27     
28     def set_meta(meta)
29       meta.each {|name, value| send :"#{name}=", value } if meta
30     end
31   end
32 end