From 44de71ba948e5318b09ea57f5a26ed548277ba44 Mon Sep 17 00:00:00 2001 From: Marko Seppae Date: Wed, 27 Aug 2008 10:16:25 +0200 Subject: I18n: removed #populate and #store_translations from api --- activesupport/lib/active_support/vendor/i18n-0.0.1/i18n.rb | 12 ------------ .../active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb | 5 ++++- 2 files changed, 4 insertions(+), 13 deletions(-) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n.rb b/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n.rb index 9e347d94e9..0988ea8f44 100755 --- a/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n.rb +++ b/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n.rb @@ -49,13 +49,6 @@ module I18n @@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 @@ module I18n 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. # diff --git a/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb b/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb index a53f7fe772..45d61fae31 100644 --- a/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb +++ b/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb @@ -47,12 +47,15 @@ module I18n 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]) -- cgit v1.2.3 From 0fcd5b5466461e44b6f3b007fa2a2fdf43f55681 Mon Sep 17 00:00:00 2001 From: Marko Seppae Date: Wed, 27 Aug 2008 10:36:00 +0200 Subject: I18n: removed call to #populate from main library files --- activesupport/lib/active_support.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'activesupport') diff --git a/activesupport/lib/active_support.rb b/activesupport/lib/active_support.rb index ae3e2360cd..2500fd79fb 100644 --- a/activesupport/lib/active_support.rb +++ b/activesupport/lib/active_support.rb @@ -55,9 +55,7 @@ require 'active_support/base64' require 'active_support/time_with_zone' -I18n.populate do - I18n.load_translations File.dirname(__FILE__) + '/active_support/locale/en-US.yml' -end +I18n.load_translations File.dirname(__FILE__) + '/active_support/locale/en-US.yml' Inflector = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('Inflector', 'ActiveSupport::Inflector') Dependencies = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('Dependencies', 'ActiveSupport::Dependencies') -- cgit v1.2.3 From cba83ede5de1b2630e244d46536439673f328900 Mon Sep 17 00:00:00 2001 From: Marko Seppae Date: Wed, 27 Aug 2008 12:00:14 +0200 Subject: I18n: remove #populate from Simple backend as well --- .../lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb | 7 ------- 1 file changed, 7 deletions(-) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb b/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb index 45d61fae31..2e966a51be 100644 --- a/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb +++ b/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb @@ -3,13 +3,6 @@ require 'strscan' module I18n module Backend class Simple - # 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) - yield - end - # Accepts a list of paths to translation files. Loads translations from # plain Ruby (*.rb) or YAML files (*.yml). See #load_rb and #load_yml # for details. -- cgit v1.2.3