Skip to content

Commit

Permalink
Localize Voiceover strings in Fabric (#37679)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #37679

This reuses the localizations from the last diff on the stack, on top of the new logic added with D45797554.

Changelog:
[iOS][Fixed] - Localize Voiceover strings in Fabric

Reviewed By: philIip

Differential Revision: D46426571

fbshipit-source-id: 7e6adc9eff5e6387299e95b6ea5eba8e2607386a
  • Loading branch information
NickGerleman authored and facebook-github-bot committed Jun 12, 2023
1 parent 0e99b19 commit 1f45459
Showing 1 changed file with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#import <React/RCTAssert.h>
#import <React/RCTBorderDrawing.h>
#import <React/RCTConversions.h>
#import <React/RCTLocalizedString.h>
#import <react/renderer/components/view/ViewComponentDescriptor.h>
#import <react/renderer/components/view/ViewEventEmitter.h>
#import <react/renderer/components/view/ViewProps.h>
Expand Down Expand Up @@ -731,28 +732,38 @@ - (NSString *)accessibilityValue
// these to screenreader users. (They should already be familiar with them
// from using web).
if ([roleString isEqualToString:@"checkbox"]) {
[valueComponents addObject:@"checkbox"];
[valueComponents addObject:RCTLocalizedString("checkbox", "checkable interactive control")];
}

if ([roleString isEqualToString:@"radio"]) {
[valueComponents addObject:@"radio button"];
[valueComponents
addObject:
RCTLocalizedString(
"radio button",
"a checkable input that when associated with other radio buttons, only one of which can be checked at a time")];
}

// Handle states which haven't already been handled.
if (props.accessibilityState.checked == AccessibilityState::Checked) {
[valueComponents addObject:@"checked"];
[valueComponents
addObject:RCTLocalizedString("checked", "a checkbox, radio button, or other widget which is checked")];
}
if (props.accessibilityState.checked == AccessibilityState::Unchecked) {
[valueComponents addObject:@"unchecked"];
[valueComponents
addObject:RCTLocalizedString("unchecked", "a checkbox, radio button, or other widget which is unchecked")];
}
if (props.accessibilityState.checked == AccessibilityState::Mixed) {
[valueComponents addObject:@"mixed"];
[valueComponents
addObject:RCTLocalizedString(
"mixed", "a checkbox, radio button, or other widget which is both checked and unchecked")];
}
if (props.accessibilityState.expanded) {
[valueComponents addObject:@"expanded"];
[valueComponents
addObject:RCTLocalizedString("expanded", "a menu, dialog, accordian panel, or other widget which is expanded")];
}

if (props.accessibilityState.busy) {
[valueComponents addObject:@"busy"];
[valueComponents addObject:RCTLocalizedString("busy", "an element currently being updated or modified")];
}

if (valueComponents.count > 0) {
Expand Down

0 comments on commit 1f45459

Please sign in to comment.