Skip to content

Flexibility of outlook categories translation#12432

Merged
feerrenrut merged 1 commit into
betafrom
fixPluralTranslationOfCategories
May 19, 2021
Merged

Flexibility of outlook categories translation#12432
feerrenrut merged 1 commit into
betafrom
fixPluralTranslationOfCategories

Conversation

@feerrenrut

@feerrenrut feerrenrut commented May 19, 2021

Copy link
Copy Markdown
Contributor

Allow translators to adjust order and spacing for categories in outlook

Link to issue number:

fixes #12417

Summary of the issue:

We use ngettext in one location, essentially a trial for now.
Currently this does not allow translators to change spacing, or to change word order.
Two strings are essentially joined together without consideration of the language grammar.

Description of how this pull request fixes the issue:

Give the translators more flexibility by allowing them to place the translation text.

Testing strategy:

Build and run locally.
Ensured that annoucing categories in outlook works as expected.

Known issues with pull request:

Due to the format of the categories list provided by outlook, it may not be possible to create completely natural sentances in all languages.

Change log entries:

None

Code Review Checklist:

  • Pull Request description is up to date.
  • Unit tests.
  • System (end to end) tests.
  • Manual tests.
  • User Documentation.
  • Change log entry.
  • Context sensitive help for GUI changes.

Allow translators to adjust order and spacing for categories in outlook
@feerrenrut feerrenrut requested a review from a team as a code owner May 19, 2021 03:49
@feerrenrut feerrenrut requested review from seanbudd and removed request for a team May 19, 2021 03:49

@seanbudd seanbudd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@CyrilleB79

Copy link
Copy Markdown
Contributor

@feerrenrut, this PR seems to have been tested on a code version that differs from the one that has just been merged.
I was about to comment on this PR but unfortunately it has just been merged.
Thus I have opened a fix-up PR against beta (#12435).

feerrenrut pushed a commit that referenced this pull request May 20, 2021
In Outlook Calendar, KeyError in the log when tabbing on an appointment having an associated category.

In #12432, .format was used without key word argument, whereas the string to be formatted contained a named interpolated value.
seanbudd pushed a commit to nvaccess/mrconfig that referenced this pull request Jun 13, 2023
Preliminary to nvaccess/nvda#12445

Context
A first use of ngettext had been introduced in NVDA in nvaccess/nvda#11598 and nvaccess/nvda#12432.
However these changes were removed in nvaccess/nvda#12448.

Issue
As written by @michaelDCurran in nvaccess/nvda#12448:

However, it seems that our PO validation code in the translation system is not handling plural forms well, and is incorrectly classing translations as missing brace format variables, as it is incorrectly comparing the translation with the message before that one.
It then outputs the following error:
Message starting on line 7169
Original: "{startTime} to {endTime}"
Translated: "category {categories}"
Error: missing brace format interpolation, extra brace format interpolation
Expected: these brace format interpolations: {endTime}, {startTime}
Got: these brace format interpolations: {categories}

Changes in this PR
This PR adds the support of ngettext messages in the PO validation script.
seanbudd pushed a commit that referenced this pull request Jun 19, 2023
This PR is the first step to reintroduce the distinction of singulare/plural forms when formatting UI strings. The project is as follow:
1. This PR introduce three strings to be able to test the feature.
2. 2023.2 beta phase should be used to validate more widely the feature with translators
3. A second PR during 2023.3 dev cycle will implement the plural forms for all UI strings containing only one value to format them.
4. A third PR should implement more complex cases of string formatted by two or more values, e.g. such as "table with x rows and y columns".

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:
* "with %s items" (used to describe the number of items in a list on the web)
* ".1f lines" (used when reporting multiple line spacing formatting in MS Word)
* ""categories {categories}" used to report categories of appointments in MS Outlook

Translators will be able to translate singular or plural forms.

### Description of development approach
* First revert #12448 to restore the first attempt that was made to introduce `ngettext`.
* Develop a custom `npgettext` function the same way as `pgettext` was introduced in NVDA since `npgettext` is not available in Python 3.7; `pgettext` and `npgettext` are available natively in Python 3.8.
* `ngettext` and `npgettext` are made accessible without importing them; `pgettext` was already added previously in builtins.
* Implement the plural form for two strings that are more commonly used than Outlook appointments category reporting:
  * "with %s items", using `ngettext`
  * "%.1f lines", using `npgettext`
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.

4 participants