diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-08-31 19:00:29 +0200 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-08-31 21:13:02 +0200 |
commit | 538104bdd1f8f8905e2bc514bc5f94d564e3bbef (patch) | |
tree | 8c0c66404943d64958be0aca521ec2e5c690539c | |
parent | abe198723d76cea1b7f151a15789d26a3d22ad4d (diff) | |
download | gitlab-ce-538104bdd1f8f8905e2bc514bc5f94d564e3bbef.tar.gz |
Fetch all translation keys using a regex
-rw-r--r-- | lib/gitlab/i18n/translation_entry.rb | 6 | ||||
-rw-r--r-- | spec/lib/gitlab/i18n/po_linter_spec.rb | 2 |
2 files changed, 2 insertions, 6 deletions
diff --git a/lib/gitlab/i18n/translation_entry.rb b/lib/gitlab/i18n/translation_entry.rb index 75d5aa0cfe1..8d4fec0decd 100644 --- a/lib/gitlab/i18n/translation_entry.rb +++ b/lib/gitlab/i18n/translation_entry.rb @@ -67,11 +67,7 @@ module Gitlab private def translation_keys - @translation_keys ||= if has_plural? - entry_data.keys.select { |key| key =~ /msgstr\[\d+\]/ } - else - [:msgstr] - end + @translation_keys ||= entry_data.keys.select { |key| key.to_s =~ /\Amsgstr(\[\d+\])?\z/ } end end end diff --git a/spec/lib/gitlab/i18n/po_linter_spec.rb b/spec/lib/gitlab/i18n/po_linter_spec.rb index 97a8c105264..bd31f0c3871 100644 --- a/spec/lib/gitlab/i18n/po_linter_spec.rb +++ b/spec/lib/gitlab/i18n/po_linter_spec.rb @@ -106,7 +106,7 @@ describe Gitlab::I18n::PoLinter do context 'with multiple plurals' do let(:po_path) { 'spec/fixtures/multiple_plurals.po' } - it 'has no errors' do + it 'has errors' do is_expected.not_to be_empty end end |