Skip to content

Commit

Permalink
namespace changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jsmestad committed Dec 1, 2009
1 parent 5c4df26 commit 293937b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ require 'rake/testtask'
begin
require 'jeweler'
Jeweler::Tasks.new do |gemspec|
gemspec.name = "translator"
gemspec.name = "fdl_translator"
gemspec.summary = "Rails extentions to simplify internationalization"
gemspec.email = "mike@graysky.org"
gemspec.homepage = "http://github.com/graysky/translator"
Expand Down
8 changes: 4 additions & 4 deletions lib/translator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ class Base
def translate_with_context(key, options={})
# The outer scope will typically be the controller name ("blog_posts")
# but can also be a dir of shared partials ("shared").
outer_scope = self.template.base_path
outer_scope = self.template.base_path.split('/')

# The template will be the view being rendered ("show.erb" or "_ad.erb")
inner_scope = self.template.name
Expand All @@ -265,7 +265,7 @@ def translate_with_context(key, options={})
# In the case of a missing translation, fall back to letting TranslationHelper
# put in span tag for a translation_missing.
begin
Translator.translate_with_scope([outer_scope, inner_scope], key, options.merge({:raise => true}))
Translator.translate_with_scope([outer_scope, inner_scope].flatten, key, options.merge({:raise => true}))
rescue Translator::TranslatorError, I18n::MissingTranslationData => exc
# Call the original translate method
str = translate_without_context(key, options)
Expand Down Expand Up @@ -297,7 +297,7 @@ class Base
# is being invoked. Initial scoping will be [:controller_name :action_name] when looking up keys. Example would be
# +['posts' 'show']+ for the +PostsController+ and +show+ action.
def translate_with_context(key, options={})
Translator.translate_with_scope([self.controller_name, self.action_name], key, options)
Translator.translate_with_scope([self.controller_path.split('/'), self.action_name].flatten, key, options)
end

alias_method_chain :translate, :context
Expand Down Expand Up @@ -334,7 +334,7 @@ class Base
# is being invoked. Initial scoping of [:mailer_name :action_name] where mailer_name is like 'comment_mailer'
# and action_name is 'comment_notification' (note: no "deliver_" or "create_")
def translate(key, options={})
Translator.translate_with_scope([self.mailer_name, self.action_name], key, options)
Translator.translate_with_scope([self.mailer_name.split('/'), self.action_name].flatten, key, options)
end

alias :t :translate
Expand Down

0 comments on commit 293937b

Please sign in to comment.