Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Make sure file names are always flattened

  • Loading branch information...
commit 7ff8f9a7e87c1f0c03c52f83c6e8e34d50f5c1ae 1 parent c9259ca
Мар'ян Крекотень (Marjan Krekoteń) krekoten authored svenfuchs committed

Showing 2 changed files with 6 additions and 2 deletions. Show diff stats Hide diff stats

  1. +2 2 lib/i18n/backend/base.rb
  2. +4 0 test/backend/simple_test.rb
4 lib/i18n/backend/base.rb
@@ -11,8 +11,8 @@ module Base
11 11 # plain Ruby (*.rb) or YAML files (*.yml). See #load_rb and #load_yml
12 12 # for details.
13 13 def load_translations(*filenames)
14   - filenames = I18n.load_path.flatten if filenames.empty?
15   - filenames.each { |filename| load_file(filename) }
  14 + filenames = I18n.load_path if filenames.empty?
  15 + filenames.flatten.each { |filename| load_file(filename) }
16 16 end
17 17
18 18 # This method receives a locale, a data hash and options for storing translations.
4 test/backend/simple_test.rb
@@ -42,6 +42,10 @@ def setup
42 42 assert_equal expected, translations
43 43 end
44 44
  45 + test "simple load_translations: given file names as array it does not raise anything" do
  46 + assert_nothing_raised { I18n.backend.load_translations(["#{locales_dir}/en.rb", "#{locales_dir}/en.yml"]) }
  47 + end
  48 +
45 49 # storing translations
46 50
47 51 test "simple store_translations: stores translations, ... no, really :-)" do

0 comments on commit 7ff8f9a

Please sign in to comment.
Something went wrong with that request. Please try again.