nvda icon indicating copy to clipboard operation
nvda copied to clipboard

Poedit: ensure scripts work no matter how many plurals a language has

Open michaelDCurran opened this issue 9 months ago • 7 comments

Link to issue number:

Fixes #16318

Summary of the issue:

Recently the poedit appModule was rewritten to support poedit 3.4. However, scripts for reading translation nodes, comments and old source text did not function for languages that had no plurals (Chinese) or 2 or more plurals (Polish). It did however function for languages with exactly one plural (such as French). As the controlIDs for windows in poedit are not static, but do stay relative to each other, the appModule originally used offsets from the main dataView control. This worked okay for the translation warning, but did not work for controls in the sidebar in all cases, as it seems that there are extra controlIDs consumed for some hidden windows between the main splitter and the sidebar, depending on how many plurals a language has. E.g. In French, the controlID offset for the Sidebar (relative to the Dataview control) is 29. In Chinese it is 27, and in Plish it is 33. I think it might be roughly two offsets per plural.

Description of user facing changes

Poedit scripts such as Report translation notes (control+shift+a), Report comments (control+shift+c) and Report old source text (control+shift+o) now function no matter how many plurals a language has.

Description of development approach

  • Control ID offsets for controls in the sidebar (such as translation notes, old source text, and comments) are now relative to the sidebar itself, rather than the Dataview control.
  • The sidebar window is located by first finding the main splitter window (using a controlID relative to the dataview control) and then finding the next visible sibling window from there.
  • To aide in refactoring, support for controlID offsets in the Pro version are now handled by simply minusing 5 from the given controlID offset, as all the offsets in the pro version differed by 5.

Testing strategy:

With a fr, zh_CN, and pl po files, tested control+shift+w, control+shift+a, control+shift+c and control+shift+o on an entry that contained a warning, a translation note, a comment, and old source text respectively.

  • [ ] Do the same tests with the Pro version. Anyone have the pro version?

Known issues with pull request:

None known.

Code Review Checklist:

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

michaelDCurran avatar May 22 '24 09:05 michaelDCurran