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 1 year 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

@michaelDCurran Thanks a lot for diving into this! @zstanecic or @ruifontes, could you have a try with the pro version?

LeonarddeR avatar May 22 '24 09:05 LeonarddeR

Also mentioning @gregjozk, @DraganRatkovich, @Adriani90, @CyrilleB79 and @cary-rowen to get broader feedback.

LeonarddeR avatar May 22 '24 09:05 LeonarddeR

  • Build execution time has reached the maximum allowed time for your plan (60 minutes).

See test results for failed build of commit a95f5944b0

AppVeyorBot avatar May 22 '24 10:05 AppVeyorBot

The issue was present in 2024.1 and has been reported on mailing lists. So a change log item should be added (bug fix).

CyrilleB79 avatar May 22 '24 14:05 CyrilleB79

  • Build execution time has reached the maximum allowed time for your plan (60 minutes).

See test results for failed build of commit 28b627e0cc

AppVeyorBot avatar May 22 '24 22:05 AppVeyorBot

LGTM, I tested in Simplified Chinese environment and everything works as expected.

cary-rowen avatar May 23 '24 03:05 cary-rowen

Hi, @michaelDCurran @LeonarddeR I tested the Georgian translation file using ctrl+shift+C and ctrl+shift+A, which I use often, and everything works fine. Thanks a lot.

DraganRatkovich avatar May 23 '24 07:05 DraganRatkovich