Change i18n
rendering for edition_count
in lazy work preview
#9708
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Subtask of #9486.
Fix. Ensures issue count renders correctly in list edit page.
Technical
As the result of a change in #9506 to improve the
i18n
inLazyWorkPreview.html
, the list edit page displayed the following error and did not correctly substitute the variable in thei18n
text:I was able to clear the error with the first commit, by switching the
%(count)d
to%(count)s
so as to correctly type the variable, but the incorrect text (%(count)s editions
) was still rendering.I confirmed by trying a variable substitution in the author field that the
jsdef
format does not seem to accept%s
substitutions ini18n
text, which would explain why for the author field theby
isi18n
-ed by itself, instead of following the more traditional$_('by %(author)s', author=author.name)
pattern.As a stop-gap measure, I switched the edition field to likewise be
i18n
-ed separately, so that the word "edition" or "editions" is displayed conditionally based on the edition count, and is translated separately from the number, so it will always appear after.This should be fine for many languages, but for languages with different word order and/or different numbering systems it's not ideal.
But if there's no other quick fix to improve the
jsdef
i18n
process, this should definitely get the job done for now -- and it's a big advantage over both the error-ed version of the page and the original version in which the word "edition" was not translated at all.Testing
Screenshot
Stakeholders
@cdrini