Skip to content

Commit

Permalink
Make sure file names are always flattened
Browse files Browse the repository at this point in the history
  • Loading branch information
krekoten authored and Sven Fuchs committed Feb 13, 2011
1 parent c9259ca commit 7ff8f9a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/i18n/backend/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ module Base
# plain Ruby (*.rb) or YAML files (*.yml). See #load_rb and #load_yml
# for details.
def load_translations(*filenames)
filenames = I18n.load_path.flatten if filenames.empty?
filenames.each { |filename| load_file(filename) }
filenames = I18n.load_path if filenames.empty?
filenames.flatten.each { |filename| load_file(filename) }
end

# This method receives a locale, a data hash and options for storing translations.
Expand Down
4 changes: 4 additions & 0 deletions test/backend/simple_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ def setup
assert_equal expected, translations
end

test "simple load_translations: given file names as array it does not raise anything" do
assert_nothing_raised { I18n.backend.load_translations(["#{locales_dir}/en.rb", "#{locales_dir}/en.yml"]) }
end

# storing translations

test "simple store_translations: stores translations, ... no, really :-)" do
Expand Down

0 comments on commit 7ff8f9a

Please sign in to comment.