openlibrary
openlibrary copied to clipboard
i18n lines missing in messages.pot
There are some buttons on site that can't be i18nalized because there are no lines for them in messages.pot
"My books" in top navbar
"Trending Books" carousel and "Trending" button in profile hamburger
Buttons "Details" and "Related Books" don't have lines in messages.pot. In Overview labels "Publish Date", "Pages" and "Previews available in:" don't have lines for them too. Please note that "Overview" and "View %s editions" buttons have corresponding lines they just haven't been translated yet in Ukrainian i18n
Community reviews section, "Feedback?" button
Carousels on work page
"Book Details" and "Published in" labels
That's not all missing lines, I will be adding new ones when I find them.
Why are developers still being allowed to introduce code which isn't internationalized?
Wouldn't it be a lot simpler to make it part of the coding standards that everything must be internationalized? And enforce that during code reviews, of course.
Most of these are actually correctly i18n'd in the HTML ; the .pot file just needs to be regenerated! You can do this like so:
docker-compose run --rm -uroot home ./scripts/i18n-messages extract
(See https://github.com/internetarchive/openlibrary/tree/master/openlibrary/i18n ).
@bicolino34 Would you be interested in giving this one a try? You'll then just need to commit the now up-to-date .pot file, and create a PR. I can help with any of that if that sounds daunting :)
@cdrini, that script is also failing with a similar error to the one affecting copydocs.py. When not run as root it works but can't write the file due to permissions, when run as root it errors with "ModuleNotFoundError: No module named 'web'".
@agmckee Can you try it with setting python path? So:
docker-compose run --rm -uroot -e PYTHONPATH=. home ./scripts/i18n-messages extract
Yes, I should have mentioned that I already tried that. Same result. I've just now tried it again (just to eliminate any possibly error on my part), still same result - "No module named 'web'".
Oh, on unix we need -uroot
to modify files but I don't think -uroot
works correctly anymore :/ Can you try removing the .pot file and trying again without -uroot
?
If you're on Windows it should just work without -uroot
I'm not on Windows, I'm on Debian 11. As mentioned before trying it without the -uroot
option just results in no file being written due to permissions issues. I have tried removing the .pot file and it makes no difference.
Ok; try changing the permissions for the directory:
# Set the group to be the same as the openlibrary group
sudo chown -R $UID:999 .
# Give the group write access to the files
sudo chmod g+w -R .
@cdrini This command works on my Mac after removing uroot. File has been generated. @agmckee I can create a PR if you are still facing the issue.
@muditjuneja Please feel free to create a PR, I ran out of time to work on this issue while troubleshooting the command. @cdrini I can confirm changing the permissions worked for me.
Awesome, thanks folks! I'll assign this to you @muditjuneja . Please open a PR!
Hi @cdrini, I have created a PR with newly generated messages.pot file. Check here - https://github.com/internetarchive/openlibrary/pull/6893
This was the command that I ran :
docker-compose run --rm -e PYTHONPATH=. home ./scripts/i18n-messages extract