mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +00:00
add state to the accessibility label of rte formatting buttons
This commit is contained in:
@@ -381,8 +381,12 @@
|
||||
"rich_text_editor_composer_unencrypted_placeholder" = "Unencrypted message…";
|
||||
"rich_text_editor_create_link" = "Create a link";
|
||||
"rich_text_editor_edit_link" = "Edit link";
|
||||
"rich_text_editor_format_action" = "%1$@, state: %2$@";
|
||||
"rich_text_editor_format_bold" = "Apply bold format";
|
||||
"rich_text_editor_format_italic" = "Apply italic format";
|
||||
"rich_text_editor_format_state_disabled" = "disabled";
|
||||
"rich_text_editor_format_state_off" = "off";
|
||||
"rich_text_editor_format_state_on" = "on";
|
||||
"rich_text_editor_format_strikethrough" = "Apply strikethrough format";
|
||||
"rich_text_editor_format_underline" = "Apply underline format";
|
||||
"rich_text_editor_full_screen_toggle" = "Toggle full screen mode";
|
||||
|
||||
@@ -930,10 +930,20 @@ internal enum L10n {
|
||||
internal static var richTextEditorCreateLink: String { return L10n.tr("Localizable", "rich_text_editor_create_link") }
|
||||
/// Edit link
|
||||
internal static var richTextEditorEditLink: String { return L10n.tr("Localizable", "rich_text_editor_edit_link") }
|
||||
/// %1$@, state: %2$@
|
||||
internal static func richTextEditorFormatAction(_ p1: Any, _ p2: Any) -> String {
|
||||
return L10n.tr("Localizable", "rich_text_editor_format_action", String(describing: p1), String(describing: p2))
|
||||
}
|
||||
/// Apply bold format
|
||||
internal static var richTextEditorFormatBold: String { return L10n.tr("Localizable", "rich_text_editor_format_bold") }
|
||||
/// Apply italic format
|
||||
internal static var richTextEditorFormatItalic: String { return L10n.tr("Localizable", "rich_text_editor_format_italic") }
|
||||
/// disabled
|
||||
internal static var richTextEditorFormatStateDisabled: String { return L10n.tr("Localizable", "rich_text_editor_format_state_disabled") }
|
||||
/// off
|
||||
internal static var richTextEditorFormatStateOff: String { return L10n.tr("Localizable", "rich_text_editor_format_state_off") }
|
||||
/// on
|
||||
internal static var richTextEditorFormatStateOn: String { return L10n.tr("Localizable", "rich_text_editor_format_state_on") }
|
||||
/// Apply strikethrough format
|
||||
internal static var richTextEditorFormatStrikethrough: String { return L10n.tr("Localizable", "rich_text_editor_format_strikethrough") }
|
||||
/// Apply underline format
|
||||
|
||||
@@ -239,31 +239,46 @@ extension FormatItem {
|
||||
}
|
||||
|
||||
var accessibilityLabel: String {
|
||||
switch type {
|
||||
let localizedAction = switch type {
|
||||
case .bold:
|
||||
return L10n.richTextEditorFormatBold
|
||||
L10n.richTextEditorFormatBold
|
||||
case .italic:
|
||||
return L10n.richTextEditorFormatItalic
|
||||
L10n.richTextEditorFormatItalic
|
||||
case .underline:
|
||||
return L10n.richTextEditorFormatUnderline
|
||||
L10n.richTextEditorFormatUnderline
|
||||
case .strikeThrough:
|
||||
return L10n.richTextEditorFormatStrikethrough
|
||||
L10n.richTextEditorFormatStrikethrough
|
||||
case .unorderedList:
|
||||
return L10n.richTextEditorBulletList
|
||||
L10n.richTextEditorBulletList
|
||||
case .orderedList:
|
||||
return L10n.richTextEditorNumberedList
|
||||
L10n.richTextEditorNumberedList
|
||||
case .indent:
|
||||
return L10n.richTextEditorIndent
|
||||
L10n.richTextEditorIndent
|
||||
case .unindent:
|
||||
return L10n.richTextEditorUnindent
|
||||
L10n.richTextEditorUnindent
|
||||
case .inlineCode:
|
||||
return L10n.richTextEditorInlineCode
|
||||
L10n.richTextEditorInlineCode
|
||||
case .codeBlock:
|
||||
return L10n.richTextEditorCodeBlock
|
||||
L10n.richTextEditorCodeBlock
|
||||
case .quote:
|
||||
return L10n.richTextEditorQuote
|
||||
L10n.richTextEditorQuote
|
||||
case .link:
|
||||
return L10n.richTextEditorLink
|
||||
L10n.richTextEditorLink
|
||||
}
|
||||
return L10n.richTextEditorFormatAction(localizedAction, state.localizedDescription)
|
||||
}
|
||||
}
|
||||
|
||||
extension ActionState {
|
||||
/// Returns a localized string that describes the action state.
|
||||
var localizedDescription: String {
|
||||
switch self {
|
||||
case .disabled:
|
||||
L10n.richTextEditorFormatStateDisabled
|
||||
case .enabled:
|
||||
L10n.richTextEditorFormatStateOff
|
||||
case .reversed:
|
||||
L10n.richTextEditorFormatStateOn
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user