Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/copycopter_client/i18n_backend.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def translate(locale, key, options = {})
# Returns locales availabile for this Copycopter project.
# @return [Array<String>] available locales
def available_locales
cached_locales = cache.keys.map { |key| key.split('.').first }
cached_locales = cache.keys.map { |key| key.split('.').first.to_sym }
(cached_locales + super).uniq.map { |locale| locale.to_sym }
end

Expand Down
8 changes: 8 additions & 0 deletions spec/copycopter_client/i18n_backend_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ def build_backend
subject.available_locales.should =~ [:en, :es, :fr]
end

it "handles symbol locales from i18n gem" do
YAML.stubs(:load_file => { :en => { 'key' => 'value' } })
I18n.stubs(:load_path => ["test.yml"])

cache['en.key'] = ''

subject.available_locales.should =~ [:en]
end
it "queues missing keys with default" do
default = 'default value'

Expand Down