Skip to content

addonHandler: install ngettext function when calling initTranslation#15661

Merged
seanbudd merged 3 commits into
nvaccess:masterfrom
beqabeqa473:addonHandler_add_ngettext
Oct 23, 2023
Merged

addonHandler: install ngettext function when calling initTranslation#15661
seanbudd merged 3 commits into
nvaccess:masterfrom
beqabeqa473:addonHandler_add_ngettext

Conversation

@beqabeqa473

@beqabeqa473 beqabeqa473 commented Oct 21, 2023

Copy link
Copy Markdown
Contributor

Link to issue number:

None

Summary of the issue:

Currently, it is not possible to use gettext plural forms in addons.

Description of user facing changes

Nothing

Description of development approach

Refactored installing of translation functions.
Now they are defined in list just above initTranslation function, and set in the caller module itself instead of adding these functions in frame_globals.

Testing strategy:

Tested and confirmed, that plural forms are now working in addons.

Known issues with pull request:

None

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

@beqabeqa473 beqabeqa473 requested a review from a team as a code owner October 21, 2023 16:13
@beqabeqa473 beqabeqa473 force-pushed the addonHandler_add_ngettext branch from 10e6b3e to fd09e33 Compare October 21, 2023 16:16
@josephsl

josephsl commented Oct 21, 2023 via email

Copy link
Copy Markdown
Contributor

@beqabeqa473

beqabeqa473 commented Oct 21, 2023 via email

Copy link
Copy Markdown
Contributor Author

Comment thread source/addonHandler/__init__.py Outdated
Comment thread source/addonHandler/__init__.py Outdated
Resolves problem of not working plurals in addons
@beqabeqa473 beqabeqa473 force-pushed the addonHandler_add_ngettext branch from fd09e33 to b20739a Compare October 22, 2023 12:27
@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 1d3c0cc9e7

@beqabeqa473

beqabeqa473 commented Oct 22, 2023 via email

Copy link
Copy Markdown
Contributor Author

@lukaszgo1

Copy link
Copy Markdown
Contributor

In that case i won't be able to store dictionary outside the function and it is not so good.

What exactly is not good about properly encapsulating the variable inside the only function which needs it?

@lukaszgo1 lukaszgo1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, Thanks for your work on this @beqabeqa473 !

Comment thread user_docs/en/changes.t2t Outdated
@beqabeqa473

beqabeqa473 commented Oct 23, 2023 via email

Copy link
Copy Markdown
Contributor Author

@seanbudd seanbudd merged commit 841394b into nvaccess:master Oct 23, 2023
@nvaccessAuto nvaccessAuto added this to the 2024.1 milestone Oct 23, 2023
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.

6 participants