Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change i18n rendering for edition_count in lazy work preview #9708

Conversation

rebecca-shoptaw
Copy link
Collaborator

@rebecca-shoptaw rebecca-shoptaw commented Aug 7, 2024

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 in LazyWorkPreview.html, the list edit page displayed the following error and did not correctly substitute the variable in the i18n text:

Incorrectly rendered i18n

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 in i18n text, which would explain why for the author field the by is i18n-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

  1. Log in (if not logged in)
  2. Go to your lists page and hit "Edit" on any list
  3. Confirm that the page has no error banner and that the edition count renders correctly, as below:

Screenshot

Correctly rendered i18n

Stakeholders

@cdrini

@rebecca-shoptaw rebecca-shoptaw changed the title Change variable type for edition_count in lazy work preview Change i18n rendering for edition_count in lazy work preview Aug 7, 2024
@rebecca-shoptaw rebecca-shoptaw marked this pull request as ready for review August 7, 2024 20:56
@cdrini cdrini self-assigned this Aug 9, 2024
@cdrini cdrini added On testing.openlibrary.org Priority: 1 Do this week, receiving emails, time sensitive, . [managed] labels Aug 9, 2024
Copy link
Collaborator

@cdrini cdrini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cdrini cdrini merged commit 46727e2 into internetarchive:master Aug 9, 2024
4 checks passed
Souvik-Cyclic pushed a commit to Souvik-Cyclic/openlibrary that referenced this pull request Aug 17, 2024
…ernetarchive#9708)

* Change variable type for edition count

* Revert to if/else and remove variable substitution
SivanC pushed a commit to SivanC/openlibrary that referenced this pull request Aug 20, 2024
…ernetarchive#9708)

* Change variable type for edition count

* Revert to if/else and remove variable substitution
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: 1 Do this week, receiving emails, time sensitive, . [managed]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants