Skip to content

Commit 4ced6ee

Browse files
authored
Merge pull request #655 from ccutrer/lazy-loadable-duplicate-available-locales
fix LazyLoadable#available_locales duplicating locales
2 parents b9b79ab + 2acc3f4 commit 4ced6ee

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/i18n/backend/lazy_loadable.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def eager_load!
9898
# Parse the load path and extract all locales.
9999
def available_locales
100100
if lazy_load?
101-
I18n.load_path.map { |path| LocaleExtractor.locale_from_path(path) }
101+
I18n.load_path.map { |path| LocaleExtractor.locale_from_path(path) }.uniq
102102
else
103103
super
104104
end

test/backend/lazy_loadable_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def setup
77
@lazy_mode_backend = I18n::Backend::LazyLoadable.new(lazy_load: true)
88
@eager_mode_backend = I18n::Backend::LazyLoadable.new(lazy_load: false)
99

10-
I18n.load_path = [File.join(locales_dir, '/en.yml'), File.join(locales_dir, '/fr.yml')]
10+
I18n.load_path = [File.join(locales_dir, '/en.yml'), File.join(locales_dir, '/en.yaml'), File.join(locales_dir, '/fr.yml')]
1111
end
1212

1313
test "lazy mode: only loads translations for current locale" do

0 commit comments

Comments
 (0)