diff options
Diffstat (limited to 'lib/gitlab/i18n/po_linter.rb')
-rw-r--r-- | lib/gitlab/i18n/po_linter.rb | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/gitlab/i18n/po_linter.rb b/lib/gitlab/i18n/po_linter.rb index 3e9a035010f..aec3b1a3755 100644 --- a/lib/gitlab/i18n/po_linter.rb +++ b/lib/gitlab/i18n/po_linter.rb @@ -170,13 +170,18 @@ module Gitlab end def translate_plural(entry) - used_variables = entry.plural_id.scan(VARIABLE_REGEX) - variables = fill_in_variables(used_variables) + used_plural_variables = entry.plural_id.scan(VARIABLE_REGEX) + plural_variables = fill_in_variables(used_plural_variables) + + used_singular_variables = entry.msgid.scan(VARIABLE_REGEX) + singular_variables = fill_in_variables(used_singular_variables) numbers_covering_all_plurals.map do |number| translation = FastGettext::Translation.n_(entry.msgid, entry.plural_id, number) + index = index_for_pluralization(number) + variables = index == 0 ? singular_variables : plural_variables - translation % variables if used_variables.any? + translation % variables if variables.any? end end |