Permalink
Browse files

I18n: removed #populate and #store_translations from api

  • Loading branch information...
1 parent 6ec07e0 commit 44de71ba948e5318b09ea57f5a26ed548277ba44 @mseppae mseppae committed with Sven Fuchs Aug 27, 2008
@@ -49,13 +49,6 @@ def exception_handler=(exception_handler)
@@exception_handler = exception_handler
end
- # Allow client libraries to pass a block that populates the translation
- # storage. Decoupled for backends like a db backend that persist their
- # translations, so the backend can decide whether/when to yield or not.
- def populate(&block)
- backend.populate(&block)
- end
-
# Allows client libraries to pass arguments that specify a source for
# translation data to be loaded by the backend. The backend defines
# acceptable sources.
@@ -66,11 +59,6 @@ def load_translations(*args)
backend.load_translations(*args)
end
- # Stores translations for the given locale in the backend.
- def store_translations(locale, data)
- backend.store_translations locale, data
- end
-
# Translates, pluralizes and interpolates a given key using a given locale,
# scope, and default, as well as interpolation values.
#
@@ -47,12 +47,15 @@ def localize(locale, object, format = :default)
raise ArgumentError, "Object must be a Date, DateTime or Time object. #{object.inspect} given." unless object.respond_to?(:strftime)
type = object.respond_to?(:sec) ? 'time' : 'date'
+ # TODO only translate these if format is a String?
formats = translate(locale, :"#{type}.formats")
format = formats[format.to_sym] if formats && formats[format.to_sym]
# TODO raise exception unless format found?
format = format.to_s.dup
- format.gsub!(/%a/, translate(locale, :"date.abbr_day_names")[object.wday])
+ # TODO only translate these if the format string is actually present
+ # TODO check which format strings are present, then bulk translate then, then replace them
+ format.gsub!(/%a/, translate(locale, :"date.abbr_day_names")[object.wday])
format.gsub!(/%A/, translate(locale, :"date.day_names")[object.wday])
format.gsub!(/%b/, translate(locale, :"date.abbr_month_names")[object.mon])
format.gsub!(/%B/, translate(locale, :"date.month_names")[object.mon])

0 comments on commit 44de71b

Please sign in to comment.