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

[Accessibility Labels] Localise accessibility labels and update texts accordingly. #16553

Merged
merged 14 commits into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/components/LHNOptionsList/OptionRowLHN.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ const OptionRowLHN = (props) => {
hovered && !props.isFocused ? props.hoverStyle : null,
]}
>
<View accessibilityHint="Navigates to a chat" style={sidebarInnerRowStyle}>
<View accessibilityHint={props.translate('accessibilityHints.navigatesToChat')} style={sidebarInnerRowStyle}>
<View
style={[
styles.flexRow,
Expand Down Expand Up @@ -168,7 +168,7 @@ const OptionRowLHN = (props) => {
<View style={contentContainerStyles}>
<View style={[styles.flexRow, styles.alignItemsCenter, styles.mw100, styles.overflowHidden]}>
<DisplayNames
accessibilityLabel="Chat user display names"
accessibilityLabel={props.translate('accessibilityHints.chatUserDisplayNames')}
fullTitle={optionItem.text}
displayNamesWithTooltips={optionItem.displayNamesWithTooltips}
tooltipEnabled
Expand All @@ -179,7 +179,7 @@ const OptionRowLHN = (props) => {
{optionItem.isChatRoom && (
<TextPill
style={textPillStyle}
accessibilityLabel="Workspace name"
accessibilityLabel={props.translate('accessibilityHints.workspaceName')}
text={optionItem.subtitle}
/>
)}
Expand All @@ -188,7 +188,7 @@ const OptionRowLHN = (props) => {
<Text
style={alternateTextStyle}
numberOfLines={1}
accessibilityLabel="Last chat message preview"
accessibilityLabel={props.translate('accessibilityHints.lastChatMessagePreview')}
>
{optionItem.alternateText}
</Text>
Expand Down
2 changes: 1 addition & 1 deletion src/components/OptionRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ class OptionRow extends Component {
}
<View style={contentContainerStyles}>
<DisplayNames
accessibilityLabel="Chat user display names"
accessibilityLabel={this.props.translate('accessibilityHints.chatUserDisplayNames')}
fullTitle={this.props.option.text}
displayNamesWithTooltips={displayNamesWithTooltips}
tooltipEnabled={this.props.showTitleTooltip}
Expand Down
2 changes: 1 addition & 1 deletion src/components/UnreadActionIndicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Text from './Text';
import withLocalize, {withLocalizePropTypes} from './withLocalize';

const UnreadActionIndicator = props => (
<View accessibilityLabel="New message line indicator" data-action-id={props.reportActionID} style={styles.unreadIndicatorContainer}>
<View accessibilityLabel={props.translate('accessibilityHints.newMessageLineIndicator')} data-action-id={props.reportActionID} style={styles.unreadIndicatorContainer}>
<View style={styles.unreadIndicatorLine} />
<Text style={styles.unreadIndicatorText}>
{props.translate('common.new')}
Expand Down
14 changes: 14 additions & 0 deletions src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -1203,4 +1203,18 @@ export default {
},
allStates: COMMON_CONST.STATES,
allCountries: CONST.ALL_COUNTRIES,
accessibilityHints: {
navigateToChatsList: 'Navigate back to chats list',
listOfChatMessages: 'List of chat messages',
chatWelcomeMessage: 'Chat welcome message',
navigatesToChat: 'Navigates to a chat',
newMessageLineIndicator: 'New message line indicator',
chatMessage: 'Chat message',
lastChatMessagePreview: 'Last chat message preview',
loginForm: 'Login form',
listOfChats: 'List of chats',
workspaceName: 'Workspace name',
chatUserDisplayNames: 'Chat user display names',
scrollToNewestMessages: 'Scroll to newest messages',
},
};
16 changes: 15 additions & 1 deletion src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@ export default {
sayHello: '¡Saluda!',
usePlusButton: '\n\n¡También puedes usar el botón + de abajo para enviar o pedir dinero!',
},
newMessages: 'Mensajes nuevos',
reportTypingIndicator: {
isTyping: 'está escribiendo...',
areTyping: 'están escribiendo...',
Expand Down Expand Up @@ -1669,4 +1668,19 @@ export default {
ZM: 'Zambia',
ZW: 'Zimbabue',
},
accessibilityHints: {
navigateToChatsList: 'Navegar de regreso a la lista de chats',
listOfChatMessages: 'Lista de mensajes de chat',
chatWelcomeMessage: 'Mensaje de bienvenida al chat',
navigatesToChat: 'Navega a un chat',
newMessageLineIndicator: 'Indicador de nueva línea de mensaje',
chatMessage: 'mensaje de chat',
lastChatMessagePreview: 'Vista previa del último mensaje de chat',
loginForm: 'Formulario de inicio de sesión',
listOfChats: 'lista de charlas',
workspaceName: 'Nombre del espacio de trabajo',
chatUserDisplayNames: 'Nombres para mostrar de los usuarios de chat',
newMessages: 'Mensajes nuevos',
scrollToNewestMessages: 'Desplácese a los mensajes más recientes',
},
};
2 changes: 1 addition & 1 deletion src/pages/home/HeaderView.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const HeaderView = (props) => {
<Pressable
onPress={props.onNavigationMenuButtonClicked}
style={[styles.LHNToggle]}
accessibilityHint="Navigate back to chats list"
accessibilityHint={props.translate('accessibilityHints.navigateToChatsList')}
>
<Tooltip text={props.translate('common.back')} shiftVertical={4}>
<Icon src={Expensicons.BackArrow} />
Expand Down
2 changes: 1 addition & 1 deletion src/pages/home/report/FloatingMessageCounter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class FloatingMessageCounter extends PureComponent {
render() {
return (
<FloatingMessageCounterContainer
accessibilityHint="Scroll to newest messages"
accessibilityHint={this.props.translate('accessibilityHints.scrollToNewestMessages')}
containerStyles={[styles.floatingMessageCounterTransformation(this.translateY)]}
>
<View style={styles.floatingMessageCounter}>
Expand Down
4 changes: 3 additions & 1 deletion src/pages/home/report/ReportActionItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import focusTextInputAfterAnimation from '../../../libs/focusTextInputAfterAnima
import ChronosOOOListActions from '../../../components/ReportActionItem/ChronosOOOListActions';
import ReportActionItemReactions from '../../../components/Reactions/ReportActionItemReactions';
import * as Report from '../../../libs/actions/Report';
import withLocalize from '../../../components/withLocalize';

const propTypes = {
/** Report for this action */
Expand Down Expand Up @@ -240,7 +241,7 @@ class ReportActionItem extends Component {
>
<Hoverable>
{hovered => (
<View accessibilityLabel="Chat message">
<View accessibilityLabel={this.props.translate('accessibilityHints.chatMessage')}>
{this.props.shouldDisplayNewMarker && (
<UnreadActionIndicator reportActionID={this.props.action.reportActionID} />
)}
Expand Down Expand Up @@ -305,6 +306,7 @@ ReportActionItem.defaultProps = defaultProps;

export default compose(
withWindowDimensions,
withLocalize,
withNetwork(),
withBlockedFromConcierge({propName: 'blockedFromConcierge'}),
withReportActionsDrafts({
Expand Down
4 changes: 3 additions & 1 deletion src/pages/home/report/ReportActionItemCreated.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import EmptyStateBackgroundImage from '../../../../assets/images/empty-state_bac
import * as StyleUtils from '../../../styles/StyleUtils';
import withWindowDimensions, {windowDimensionsPropTypes} from '../../../components/withWindowDimensions';
import compose from '../../../libs/compose';
import withLocalize from '../../../components/withLocalize';

const propTypes = {
/** The id of the report */
Expand Down Expand Up @@ -57,7 +58,7 @@ const ReportActionItemCreated = (props) => {
style={StyleUtils.getReportWelcomeBackgroundImageStyle(props.isSmallScreenWidth)}
/>
<View
accessibilityLabel="Chat welcome message"
accessibilityLabel={props.translate('accessibilityHints.chatWelcomeMessage')}
style={[styles.p5, StyleUtils.getReportWelcomeTopMarginStyle(props.isSmallScreenWidth)]}
>
<Pressable
Expand All @@ -83,6 +84,7 @@ ReportActionItemCreated.displayName = 'ReportActionItemCreated';

export default compose(
withWindowDimensions,
withLocalize,
withOnyx({
report: {
key: ({reportID}) => `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
Expand Down
4 changes: 3 additions & 1 deletion src/pages/home/report/ReportActionsList.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import CONST from '../../../CONST';
import * as StyleUtils from '../../../styles/StyleUtils';
import reportPropTypes from '../../reportPropTypes';
import networkPropTypes from '../../../components/networkPropTypes';
import withLocalize from '../../../components/withLocalize';

const propTypes = {
/** Position of the "New" line marker */
Expand Down Expand Up @@ -150,7 +151,7 @@ class ReportActionsList extends React.Component {
return (
<Animated.View style={[StyleUtils.fade(this.state.fadeInAnimation), styles.flex1]}>
<InvertedFlatList
accessibilityLabel="List of chat messages"
accessibilityLabel={this.props.translate('accessibilityHints.listOfChatMessages')}
ref={ReportScrollManager.flatListRef}
data={this.props.sortedReportActions}
renderItem={this.renderItem}
Expand Down Expand Up @@ -208,6 +209,7 @@ ReportActionsList.defaultProps = defaultProps;
export default compose(
withDrawerState,
withWindowDimensions,
withLocalize,
withPersonalDetails(),
withNetwork(),
)(ReportActionsList);
2 changes: 1 addition & 1 deletion src/pages/home/sidebar/SidebarLinks.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class SidebarLinks extends React.Component {
return (
<View
accessibilityElementsHidden={this.props.isSmallScreenWidth && !this.props.isDrawerOpen}
accessibilityLabel="List of chats"
accessibilityLabel={this.props.translate('accessibilityHints.listOfChats')}
style={[styles.flex1, styles.h100]}
>
<View
Expand Down
2 changes: 1 addition & 1 deletion src/pages/signin/LoginForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class LoginForm extends React.Component {
const serverErrorText = ErrorUtils.getLatestErrorMessage(this.props.account);
return (
<>
<View accessibilityLabel="Login form" style={[styles.mt3]}>
<View accessibilityLabel={this.props.translate('accessibilityHints.loginForm')} style={[styles.mt3]}>
<TextInput
ref={el => this.input = el}
label={this.props.translate('loginForm.phoneOrEmail')}
Expand Down
Loading