openlibrary icon indicating copy to clipboard operation
openlibrary copied to clipboard

i18n lines missing in messages.pot

Open bicolino34 opened this issue 2 years ago • 10 comments

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.

bicolino34 avatar Aug 06 '22 17:08 bicolino34

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.

tfmorris avatar Aug 08 '22 15:08 tfmorris

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 ).

cdrini avatar Aug 08 '22 23:08 cdrini

@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 avatar Aug 08 '22 23:08 cdrini

@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 avatar Aug 10 '22 15:08 agmckee

@agmckee Can you try it with setting python path? So:

docker-compose run --rm -uroot -e PYTHONPATH=. home ./scripts/i18n-messages extract

cdrini avatar Aug 10 '22 16:08 cdrini

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'".

agmckee avatar Aug 10 '22 16:08 agmckee

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?

cdrini avatar Aug 10 '22 16:08 cdrini

If you're on Windows it should just work without -uroot

cdrini avatar Aug 10 '22 16:08 cdrini

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.

agmckee avatar Aug 10 '22 16:08 agmckee

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 avatar Aug 10 '22 18:08 cdrini

@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 avatar Aug 12 '22 20:08 muditjuneja

@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.

agmckee avatar Aug 14 '22 09:08 agmckee

Awesome, thanks folks! I'll assign this to you @muditjuneja . Please open a PR!

cdrini avatar Aug 15 '22 19:08 cdrini

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

muditjuneja avatar Aug 18 '22 20:08 muditjuneja