no longer assesses js-*.yml files to be languages of their own

pull/1752/head
Jens Ulferts 10 years ago
parent 9fdbffb033
commit 314d37b3a3
  1. 7
      lib/redmine/i18n.rb
  2. 13
      spec/lib/redmine/i18n_spec.rb

@ -101,7 +101,12 @@ module Redmine
end
def all_languages
@@all_languages ||= Dir.glob(Rails.root.join('config/locales/*.yml')).collect {|f| File.basename(f).split('.').first}.collect(&:to_sym)
@@all_languages ||= begin
Dir.glob(Rails.root.join('config/locales/*.yml'))
.map { |f| File.basename(f).split('.').first }
.reject! { |l| /\Ajs-/.match(l.to_s) }
.map(&:to_sym)
end
end
def find_language(lang)

@ -29,7 +29,7 @@
require 'spec_helper'
module OpenProject
describe I18n do
describe I18n, type: :helper do
include Redmine::I18n
let(:format) { '%d/%m/%Y' }
@ -69,5 +69,16 @@ module OpenProject
expect(format_time_as_date(time,format)).to eq '30/06/2013'
end
end
describe :all_languages do
it 'should at least return en' do
# using this to ensure that the files are evaluated
expect(all_languages).to include(:en)
end
it 'should return no js language as they are duplicates of the rest of the other language' do
expect(all_languages.any?{ |l| /\Ajs-/.match(l.to_s) }).to be_false
end
end
end
end

Loading…
Cancel
Save