Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report appointment categories in Microsoft Outlook #11598

Merged
merged 7 commits into from Mar 26, 2021

Conversation

LeonarddeR
Copy link
Collaborator

@LeonarddeR LeonarddeR commented Sep 12, 2020

Link to issue number:

None

Summary of the issue:

Outlook appointments could have multiple categories (or colors) assigned to them. However, they are not reported.

Description of how this pull request fixes the issue:

Fetch the categories from the object model and report them when appropriate.

Testing performed:

Tested appointment without, with one and with multiple categories.

Details

To reproduce / test:

  • Open Outlook
  • Press control+2 to go to calendar view
  • Tab or shift+tab to focus an appointment

Note: using up/down arrows will read the appointment, but does not focus it and will not read the category.

Tested in Outlook 2016 and 365

  • with Calendar view 'working week' and day.

If you do not have an appointment with a category, you can add one the following way:

  • Open Outlook
  • Press control+2 to go to calendar view (working week for me)
  • Tab to an appointment
  • Press context menu key
  • Select "categorize" item
  • Select a category in the sub-menu

Known issues with pull request:

None known

Change log entry:

@bramd
Copy link
Contributor

bramd commented Sep 13, 2020

@LeonarddeR Is there also a way to get this info using UIA in the newer versions of Outlook?

categories = appointment.Categories
if not categories:
return None
if len(categories.split("; ")) > 1:
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use ngettext in such cases, not every language has just one plural form.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It looks like we never use ngettext in the code base. @josephsl do you have any thoughts to share here?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it is something we should be using. Not sure if there are any issues preventing it's use, someone has to go first to test it out 😛

categories = appointment.Categories
if not categories:
return None
if len(categories.split("; ")) > 1:
Copy link
Contributor

Choose a reason for hiding this comment

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

According to https://docs.microsoft.com/en-us/office/vba/api/outlook.appointmentitem.categories the separator is saved in the registry and may differ depending on the user's locale. Could you rewrite this to fetch the separator from the registry and cache it to avoid a lookup for every appointment.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I decided to remove category count detection. It isn't worth this extra complexity. Also note that, when provided in a list view, the column header is spoken as "categories", even when there's only one.

@LeonarddeR
Copy link
Collaborator Author

@bramd wrote:

@LeonarddeR Is there also a way to get this info using UIA in the newer versions of Outlook?

Unfortunately not, there's only a MSAA implementation which is very verbose but doesn't seem to include the categories.

Copy link
Contributor

@feerrenrut feerrenrut left a comment

Choose a reason for hiding this comment

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

Would you like to try the ngettext approach? Otherwise I'll go ahead and merge.

@LeonarddeR
Copy link
Collaborator Author

Just implemented ngettext, it seems to end up in the pot file, so that's great

Copy link
Contributor

@feerrenrut feerrenrut left a comment

Choose a reason for hiding this comment

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

Overall looks good, just waiting for the comment to be added.

Copy link
Contributor

@feerrenrut feerrenrut left a comment

Choose a reason for hiding this comment

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

Thanks @LeonarddeR

@feerrenrut feerrenrut merged commit 9a1cca5 into nvaccess:master Mar 26, 2021
@nvaccessAuto nvaccessAuto added this to the 2021.1 milestone Mar 26, 2021
seanbudd added a commit that referenced this pull request May 10, 2021
A changes item was accidentally added to the wrong release header in PR #11598

Description of how this pull request fixes the issue:
Move the changelog item to the correct release
@codeofdusk
Copy link
Contributor

Latest master seems to introduce a severe lag in the Outlook calendar that I can't reproduce in 2020.4. Maybe introduced by this PR as seems to be the only Outlook change. Here's an NVDA debug log of opening the calendar and navigating over a couple of appointments.

@feerrenrut
Copy link
Contributor

@codeofdusk This PR was merged a while ago (26th March), could you confirm performance before /after this change?

@codeofdusk
Copy link
Contributor

OK, based on reports I've received the lag isn't specific to 2021.1 but is intermittently reproducible even as far back as 2020.3 on one system.

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants