Merge branch 'reprazent/gitlab-ce-bvl-find-correct-variables-for-testing-translations' into 'master'
Build correct variables for testing translations Closes #48110 See merge request gitlab-org/gitlab-ce!32871
This commit is contained in:
commit
08b0613302
2 changed files with 9 additions and 4 deletions
|
@ -170,13 +170,13 @@ module Gitlab
|
|||
end
|
||||
|
||||
def translate_plural(entry)
|
||||
used_variables = entry.plural_id.scan(VARIABLE_REGEX)
|
||||
variables = fill_in_variables(used_variables)
|
||||
|
||||
numbers_covering_all_plurals.map do |number|
|
||||
translation = FastGettext::Translation.n_(entry.msgid, entry.plural_id, number)
|
||||
index = index_for_pluralization(number)
|
||||
used_variables = index == 0 ? entry.msgid.scan(VARIABLE_REGEX) : entry.plural_id.scan(VARIABLE_REGEX)
|
||||
variables = fill_in_variables(used_variables)
|
||||
|
||||
translation % variables if used_variables.any?
|
||||
translation % variables if variables.any?
|
||||
end
|
||||
end
|
||||
|
||||
|
|
5
spec/fixtures/valid.po
vendored
5
spec/fixtures/valid.po
vendored
|
@ -1128,3 +1128,8 @@ msgid "parent"
|
|||
msgid_plural "parents"
|
||||
msgstr[0] "padre"
|
||||
msgstr[1] "padres"
|
||||
|
||||
msgid "CycleAnalytics|%{stageName}"
|
||||
msgid_plural "CycleAnalytics|%d stages selected"
|
||||
msgstr[0] "%{stageName}"
|
||||
msgstr[1] "%d stages selected"
|
||||
|
|
Loading…
Reference in a new issue