public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
I18n: removed #populate and #store_translations from api
mseppae (author)
Wed Aug 27 01:16:25 -0700 2008
svenfuchs (committer)
Wed Aug 27 01:16:25 -0700 2008
commit  44de71ba948e5318b09ea57f5a26ed548277ba44
tree    a2e7210fc62abdc5b83e01e7eeb0adf259e032eb
parent  6ec07e0737c3099056fc11fe43f4f19dde3770a6
...
49
50
51
52
53
54
55
56
57
58
59
60
61
...
66
67
68
69
70
71
72
73
74
75
76
...
49
50
51
 
 
 
 
 
 
 
52
53
54
...
59
60
61
 
 
 
 
 
62
63
64
0
@@ -49,13 +49,6 @@ module I18n
0
       @@exception_handler = exception_handler
0
     end
0
     
0
-    # Allow client libraries to pass a block that populates the translation
0
-    # storage. Decoupled for backends like a db backend that persist their
0
-    # translations, so the backend can decide whether/when to yield or not.
0
-    def populate(&block)
0
-      backend.populate(&block)
0
-    end
0
-    
0
     # Allows client libraries to pass arguments that specify a source for 
0
     # translation data to be loaded by the backend. The backend defines
0
     # acceptable sources. 
0
@@ -66,11 +59,6 @@ module I18n
0
       backend.load_translations(*args)
0
     end
0
     
0
-    # Stores translations for the given locale in the backend. 
0
-    def store_translations(locale, data)
0
-      backend.store_translations locale, data
0
-    end
0
-    
0
     # Translates, pluralizes and interpolates a given key using a given locale, 
0
     # scope, and default, as well as interpolation values.
0
     #
...
47
48
49
 
50
51
52
53
54
55
 
 
 
56
57
58
...
47
48
49
50
51
52
53
54
55
 
56
57
58
59
60
61
0
@@ -47,12 +47,15 @@ module I18n
0
         raise ArgumentError, "Object must be a Date, DateTime or Time object. #{object.inspect} given." unless object.respond_to?(:strftime)
0
         
0
         type = object.respond_to?(:sec) ? 'time' : 'date'
0
+        # TODO only translate these if format is a String?
0
         formats = translate(locale, :"#{type}.formats")
0
         format = formats[format.to_sym] if formats && formats[format.to_sym]
0
         # TODO raise exception unless format found?
0
         format = format.to_s.dup
0
 
0
-        format.gsub!(/%a/, translate(locale, :"date.abbr_day_names")[object.wday])
0
+        # TODO only translate these if the format string is actually present
0
+        # TODO check which format strings are present, then bulk translate then, then replace them
0
+        format.gsub!(/%a/, translate(locale, :"date.abbr_day_names")[object.wday]) 
0
         format.gsub!(/%A/, translate(locale, :"date.day_names")[object.wday])
0
         format.gsub!(/%b/, translate(locale, :"date.abbr_month_names")[object.mon])
0
         format.gsub!(/%B/, translate(locale, :"date.month_names")[object.mon])

Comments