Skip to content

Commit

Permalink
Change i18n rendering for edition_count in lazy work preview (#9708)
Browse files Browse the repository at this point in the history
* Change variable type for edition count

* Revert to if/else and remove variable substitution
  • Loading branch information
rebecca-shoptaw authored Aug 9, 2024
1 parent 5302bd9 commit 46727e2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
11 changes: 6 additions & 5 deletions openlibrary/i18n/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -4953,11 +4953,12 @@ msgid "Select this work"
msgstr ""

#: jsdef/LazyWorkPreview.html
#, python-format
msgid "%(count)d edition"
msgid_plural "%(count)d editions"
msgstr[0] ""
msgstr[1] ""
msgid "1 edition"
msgstr ""

#: jsdef/LazyWorkPreview.html
msgid "editions"
msgstr ""

#: languages/index.html
#, python-format
Expand Down
5 changes: 4 additions & 1 deletion openlibrary/templates/jsdef/LazyWorkPreview.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
$_('by') <span class="authors">${', '.join(work['author_name'])}</span>
</span>
&bull;
<span class="edition_count">$ungettext('%(count)d edition', '%(count)d editions', work['edition_count'], count=work['edition_count'])</span>
$if work['edition_count'] == 1:
<span class="edition_count">$_("1 edition")</span>
$else:
<span class="edition_count">$work['edition_count'] $_("editions")</span>
<div class="clear"></div>
</div>

Expand Down

0 comments on commit 46727e2

Please sign in to comment.