Plural forms support for translatable strings#15013
Conversation
… to be getting confused by it, and this was not the first and only issue. (nvaccess#12448)" This reverts commit 76fc1f7.
See test results for failed build of commit 5bbca24981 |
See test results for failed build of commit 3a954f26ef |
seanbudd
left a comment
There was a problem hiding this comment.
Thanks @CyrilleB79 - any suggestions on a change log entry?
|
I was unsure about the change log. I have no idea of something significant to put in all the end-user related sections; maybe rather when we convert all other strings of NVDA's codebase later. Maybe in changes for dev: But do not close #12445 since it is not complete. [Not: should I use "code base" or "codebase"] Is it OK for you? |
|
Thanks @CyrilleB79 - makes sense. I'm going to drop the information about the strings as that may change by release time.
|
|
@seanbudd, according to the step-by-step approach written the initial description, it is not expected to have many more strings until the release: 2023.2 should be used to test the first few strings and 2023.3 to convert the rest of NVDA's codebase. Anyway, it does not matter: the change log item that you have merged is less precise but remain correct in any case. |
|
@seanbudd, also, if possible, it would be nice to have soon a merge from master to beta (e.g. before Friday) so that we can test these strings early with translators. Thanks! |
|
@CyrilleB79 - done |
…NVDA/#15013) (#106) Issue Today, the first version of NVDA including nvaccess/nvda#15013 has been merged to SVN. The translatable strings using ngettext appear in the nvda.po as expected. But the strings using npgettext ("%.1f lignes") don't. Cause In PR nvaccess/nvda#15013, the command to build the .pot file has been updated to be able to recognize npgettext as a function operating on translatable strings. However, the nvda2svn script in the current repository does not use the .pot generated by NVDA's sconstruct; xgettext is called directly in the current repository instead. Thus the command in the nvda2svn script should match the one in NVDA's sconstruct. The change in NVDA's repository had not been duplicated here. Solution Update xgettext's parameters as per what was done in NVDA's repo to be able to detect ngettext as a function operating on translatable strings. Testing I have no way to test before merging this PR. @seanbudd, could you test manually this branch on NVAccess server the result of nvda2svn script or merge this PR and trigger nvda2svn? The string "%.1f lignes" should appear in the .pot file with a "msgid_plural" field. Also the strings "category {categories}" and "with %s item" should still have the msgid_plural field (as today)
Closes #12445 Follow-up of #15013. Summary of the issue: When possible NVDA needs to distinguish between singular and plural in UI messages. The impact may be more significant in languages such as Slavic ones, where there are more than one plural form. Description of user facing changes In NVDA UI messages, i.e. in GUI or when NVDA speaks or brailles messages, messages will use singular/plural form as needed. Description of development approach Look for all strings containing "%" or "{" in the .pot and check if a plural form is needed. And replace _ / pgettext by ngettext / npgettext where needed. Some expression containing a number have been pluralized even if they do not differ between singular and plural form in English due to the difference being visible in translations due to a different grammar. E.g.: "{numFingers} finger {action}" in English to be translated to "{action} {numFingers} doigt" (singular) vs "{action} {numFingers} doigts" (plural) in French. table-rowcount and table-columncount control fields of the virtual buffer's text info have had to be converted to integer (previously strings), so that computation can be done. No change log needed except for the code's API breaking change. Testing strategy: Manual smoke test on a subset of strings. Feedback from translators during translation period and communication with the translators mailing list
This PR is the first step to reintroduce the distinction of singulare/plural forms when formatting UI strings. The project is as follow:
This step-by-step approach should allow to lose less work in case an issue occurs and requires to revert changes.
Link to issue number:
First step to implement #12445.
Restoring #11598, #12432 and #12435 that were reverted in #12448.
Unblocked by nvaccess/mrconfig#97.
Summary of the issue:
Some UI messages or strings are reported with plural form, no matter the number passed as parameter to format them, e.g. NVDA reports "list with 1 items" with "s" even if there is only one item.
Description of user facing changes
The following strings will be reported using singular or plural form depending on the number used to format them:
Translators will be able to translate singular or plural forms.
Description of development approach
ngettext.npgettextfunction the same way aspgettextwas introduced in NVDA sincenpgettextis not available in Python 3.7;pgettextandnpgettextare available natively in Python 3.8.ngettextandnpgettextare made accessible without importing them;pgettextwas already added previously in builtins.ngettextnpgettextTesting strategy:
I have tested the 3 modified strings in the situation where they are reported:
Note: for MS Word, since reporting a line spacing of 1 line is not possible, I have tested in the console:
The checks were done for the following languages:
Known issues with pull request:
Other strings with plural forms to be implemented in subsequent PRs.
Change log entries:
New features
Changes
Bug fixes
For Developers
TBD
Code Review Checklist:
Cc @LeonarddeR (author of 11598)
Cc @zstanecic (translator of various Slavic languages) Slavic languages are known to have complex forms of plural