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

PICARD-2003: Include locales as package data inside the main package. #2591

Merged
merged 1 commit into from
Feb 25, 2025

Conversation

phw
Copy link
Member

@phw phw commented Feb 25, 2025

Summary

  • This is a…
    • Bug fix
    • Feature addition
    • Refactoring
    • Minor / simple change (like a typo)
    • Other
  • Describe this change in 1-2 sentences:

Problem

If picard got installed by pip install picard the translations where unavailable. That is because the locale files got included as a data files outside the package folder, and there is no default way to get this data folder.

This PR ensures locales are available also in pip installs by moving the locale as data files into the picard package.

Solution

Move the locale directory holding the *.mo files into the picard package and include them as data files in the source package and wheel. Adjust the loading to use this locale dir by default.

This simplifies the code to build the locales, as there are no longer separate build target directories. This also removes the need to run setup.py build_locales -i after setup.py build for local development.

Separate handling is needed for pyinstaller "frozen" install. Oherwise the location of the locales is now always the same.

See also https://setuptools.pypa.io/en/latest/userguide/datafiles.html#interplay-between-these-keywords

This ensures locales are available also in pip installs.
@phw phw requested a review from zas February 25, 2025 17:16
Copy link
Collaborator

@zas zas left a comment

Choose a reason for hiding this comment

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

I'm amazed how much lines aren't needed anymore, good move ;)

@phw
Copy link
Member Author

phw commented Feb 25, 2025

@zas I hope we can keep it this way. Should someone really insist on having a way to install locales in /use/share/ again we will need to add something back, though. But I hope we don't need that, and if we do I think we can have it simpler than before.

@phw phw merged commit 70b23e1 into metabrainz:master Feb 25, 2025
49 checks passed
@phw phw deleted the PICARD-2003-translations-as-package-data branch February 25, 2025 19:30
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.

2 participants