instance method
load_file
Ruby on Rails 2.3.18
Since v2.3.18 Last seen in v2.3.18Signature
load_file(filename)
Loads a single translations file by delegating to #load_rb or #load_yml depending on the file extension and directly merges the data to the existing translations. Raises I18n::UnknownFileType for all other file extensions.
Parameters
-
filenamereq
Source
# File activesupport/lib/active_support/vendor/i18n-0.4.1/i18n/backend/base.rb, line 211
def load_file(filename)
type = File.extname(filename).tr('.', '').downcase
raise UnknownFileType.new(type, filename) unless respond_to?(:"load_#{type}")
data = send(:"load_#{type}", filename) # TODO raise a meaningful exception if this does not yield a Hash
data.each { |locale, d| store_translations(locale, d) }
end
Defined in activesupport/lib/active_support/vendor/i18n-0.4.1/i18n/backend/base.rb line 211
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in I18n::Backend::Base