Sha256: f4f784c1a88cd666db35265eec7acccbe1654c410c0ef4e00e188b59eff8994d

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

=begin
  locale_rails/lib/action_view.rb - Ruby/Locale for "Ruby on Rails"

  Copyright (C) 2008  Masao Mutoh

  You may redistribute it and/or modify it under the same
  license terms as Ruby.

  Original: Ruby-GetText-Package-1.92.0

  $Id: action_view.rb 23 2008-11-24 09:22:35Z mutoh $
=end

require 'action_view'

module ActionView #:nodoc:
  class Base
    def _pick_template_with_locale_main(template_path, tags)
      path = template_path.sub(/^\//, '')
      if m = path.match(/(.*)\.(\w+)$/)
        template_file_name, template_file_extension = m[1], m[2]
      else
        template_file_name = path
      end
 
      tags.each do |v|
        file_name = "#{template_file_name}_#{v}"
	begin
          return _pick_template_without_locale(file_name)
        rescue MissingTemplate => e
	end
      end
      _pick_template_without_locale(template_path)
    end
    memoize :_pick_template_with_locale_main

    def _pick_template_with_locale(template_path) #: shouldn't memoize.
      _pick_template_with_locale_main(template_path, I18n.candidates)
    end
    alias_method_chain :_pick_template, :locale
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
locale_rails-0.1.0 lib/locale_rails/action_view.rb