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

Prevent gettext() from binding to _ namespace #821

Merged
merged 12 commits into from
Aug 22, 2023
Merged

Conversation

caronc
Copy link
Owner

@caronc caronc commented Feb 12, 2023

Description:

Related issue (if applicable): #807

Python states that while it provides the gettext.install() function (to install translations globally into the built-in (_), it isn't ideal as the last person who calls this over-rides the global built-in. Basically system can do this, but plugins like Apprise should not.


Python Official Reference
Key quote to take away from above link:

localized modules should never install _(). Instead, they should use this code to make _() available to their module:

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • No lint errors (use flake8)
  • 100% test coverage

Testing

Anyone can help test this source code as follows:

# Create a virtual environment to work in as follows:
python3 -m venv apprise

# Change into our new directory
cd apprise

# Activate our virtual environment
source bin/activate

# Install the branch
pip install git+https://github.com/caronc/apprise.git@807-gettext-namespacing

# Test out the changes with the following command:
apprise -vvvv -l

@codecov-commenter
Copy link

codecov-commenter commented Feb 12, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.01% 🎉

Comparison is base (5fd568f) 99.51% compared to head (deec3f9) 99.52%.
Report is 1 commits behind head on master.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #821      +/-   ##
==========================================
+ Coverage   99.51%   99.52%   +0.01%     
==========================================
  Files         123      123              
  Lines       16345    16360      +15     
  Branches     3329     3329              
==========================================
+ Hits        16266    16283      +17     
+ Misses         70       68       -2     
  Partials        9        9              
Files Changed Coverage Δ
apprise/AppriseLocale.py 100.00% <100.00%> (ø)

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@caronc caronc force-pushed the 807-gettext-namespacing branch 2 times, most recently from 0f18aad to 8854635 Compare February 17, 2023 22:59
@caronc caronc merged commit f82934a into master Aug 22, 2023
12 checks passed
@caronc caronc deleted the 807-gettext-namespacing branch October 8, 2023 12:58
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.

None yet

2 participants