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

Fixes translated languages not being localized on edition edit page #8622

Conversation

Nick3791
Copy link
Contributor

Closes #8174

Hi, I'm a new contributor, I'm working with @karlitto01 to try to learn more about the codebase and find ways to contribute to OpenLibrary :)

In the issue above, the language an edition was originally translated from did not appear in the localized language on the edition edit page, this is a small fix for that issue.

Technical

I simply wrapped the initial value of the the language field in a '$_()' call. I believe this should correctly translate the text to the localized version.

Testing

Steps I took to test this:

  • Setup dev environment
  • Built the translation files
  • Imported the work mentioned in the issue above (OL16656007W) to the dev environment.
  • On the site, changed the language to Deutsch (but could use French like in the original issue)
  • Going to the French edition of that work, and clicking "Edit"
    Both the original language from which the work was translated and the language of the current edition should be localized.

Screenshot

Here's the screenshot of the same work as in the original issue, with the page in English, and Deutsch respectively:
English
image
Deutsch
image

Stakeholders

@cdrini

@cdrini cdrini self-assigned this Dec 14, 2023
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.

Hi @Nick3791 ! Thanks for the PR :) This won't quite do the trick ; the _ function only translates things that have been translated in our .po files. The translated language names however live in our db.

Look at the function render_language_field ; it takes a third parameter, i18n_name. We'll want to update render_translated_from_language_field to also take a third parameter in the same way! That should fix it.

Note I think the local environment doesn't have all the translated language, so you might not see it change while testing, unfortunately. But if you follow the same pattern as render_language_field, everything should work!

@cdrini cdrini added the Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed] label Dec 14, 2023
language from which it was translated from is not correctly localized.
This commit fixes the issue by wrapping the language name in the
gettext() function which should translate the text.
…anslate language names, using the output of the get_language_name() function call.
@Nick3791 Nick3791 force-pushed the 8174/fix/fixing-original-language-on-edition-edit-page-not-localized branch from de75839 to ddc8c4d Compare December 16, 2023 03:45
@Nick3791
Copy link
Contributor Author

Hi @cdrini,

Thanks for reviewing it. I updated the render_translated_from_language_field function to be like render_language_field and updated both places it was being called. It should now display the result from get_language_name rather than the translated version from the _ function.

Unfortunately, as you mentioned, I cannot see the updates on the local environment.

@cdrini cdrini removed the Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed] label Dec 16, 2023
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.

Tossed it on testing.openlibrary.org ; works like a charm! Thanks @Nick3791 !

image

@cdrini cdrini merged commit 38e0c7c into internetarchive:master Dec 16, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Original language / translated_from field value not localized on Edition edit page
2 participants