i18n for accessibility hint

This commit is contained in:
Jed Fox 2022-12-21 19:38:05 -05:00
parent dc6a86f846
commit f5c6529341
No known key found for this signature in database
GPG Key ID: 0B61D18EA54B47E1
5 changed files with 32 additions and 11 deletions

View File

@ -144,7 +144,6 @@
"tap_to_reveal": "Tap to reveal",
"load_embed": "Load Embed",
"link_via_user": "%s via %s",
"media_label": "%s, attachment %d of %d",
"poll": {
"vote": "Vote",
"closed": "Closed"
@ -188,6 +187,12 @@
"unknown_language": "Unknown",
"unknown_provider": "Unknown",
"show_original": "Shown Original"
},
"media": {
"accessibility_label": "%s, attachment %d of %d",
"expand_image_hint": "Expands the image. Double-tap and hold to show actions",
"expand_gif_hint": "Expands the GIF. Double-tap and hold to show actions",
"expand_video_hint": "Shows the video player. Double-tap and hold to show actions"
}
},
"friendship": {

View File

@ -144,7 +144,6 @@
"tap_to_reveal": "Tap to reveal",
"load_embed": "Load Embed",
"link_via_user": "%s via %s",
"media_label": "%s, attachment %d of %d",
"poll": {
"vote": "Vote",
"closed": "Closed"
@ -188,6 +187,12 @@
"unknown_language": "Unknown",
"unknown_provider": "Unknown",
"show_original": "Shown Original"
},
"media": {
"accessibility_label": "%s, attachment %d of %d",
"expand_image_hint": "Expands the image. Double-tap and hold to show actions",
"expand_gif_hint": "Expands the GIF. Double-tap and hold to show actions",
"expand_video_hint": "Shows the video player. Double-tap and hold to show actions"
}
},
"friendship": {

View File

@ -298,10 +298,6 @@ public enum L10n {
public static let loadEmbed = L10n.tr("Localizable", "Common.Controls.Status.LoadEmbed", fallback: "Load Embed")
/// Tap anywhere to reveal
public static let mediaContentWarning = L10n.tr("Localizable", "Common.Controls.Status.MediaContentWarning", fallback: "Tap anywhere to reveal")
/// %@, attachment %d of %d
public static func mediaLabel(_ p1: Any, _ p2: Int, _ p3: Int) -> String {
return L10n.tr("Localizable", "Common.Controls.Status.MediaLabel", String(describing: p1), p2, p3, fallback: "%@, attachment %d of %d")
}
/// Sensitive Content
public static let sensitiveContent = L10n.tr("Localizable", "Common.Controls.Status.SensitiveContent", fallback: "Sensitive Content")
/// Show Post
@ -344,6 +340,18 @@ public enum L10n {
/// Undo reblog
public static let unreblog = L10n.tr("Localizable", "Common.Controls.Status.Actions.Unreblog", fallback: "Undo reblog")
}
public enum Media {
/// %@, attachment %d of %d
public static func accessibilityLabel(_ p1: Any, _ p2: Int, _ p3: Int) -> String {
return L10n.tr("Localizable", "Common.Controls.Status.Media.AccessibilityLabel", String(describing: p1), p2, p3, fallback: "%@, attachment %d of %d")
}
/// Expands the GIF. Double-tap and hold to show actions
public static let expandGifHint = L10n.tr("Localizable", "Common.Controls.Status.Media.ExpandGifHint", fallback: "Expands the GIF. Double-tap and hold to show actions")
/// Expands the image. Double-tap and hold to show actions
public static let expandImageHint = L10n.tr("Localizable", "Common.Controls.Status.Media.ExpandImageHint", fallback: "Expands the image. Double-tap and hold to show actions")
/// Shows the video player. Double-tap and hold to show actions
public static let expandVideoHint = L10n.tr("Localizable", "Common.Controls.Status.Media.ExpandVideoHint", fallback: "Shows the video player. Double-tap and hold to show actions")
}
public enum MetaEntity {
/// Email address: %@
public static func email(_ p1: Any) -> String {

View File

@ -116,8 +116,11 @@ Please check your internet connection.";
"Common.Controls.Status.ContentWarning" = "Content Warning";
"Common.Controls.Status.LinkViaUser" = "%@ via %@";
"Common.Controls.Status.LoadEmbed" = "Load Embed";
"Common.Controls.Status.Media.AccessibilityLabel" = "%@, attachment %d of %d";
"Common.Controls.Status.Media.ExpandGifHint" = "Expands the GIF. Double-tap and hold to show actions";
"Common.Controls.Status.Media.ExpandImageHint" = "Expands the image. Double-tap and hold to show actions";
"Common.Controls.Status.Media.ExpandVideoHint" = "Shows the video player. Double-tap and hold to show actions";
"Common.Controls.Status.MediaContentWarning" = "Tap anywhere to reveal";
"Common.Controls.Status.MediaLabel" = "%@, attachment %d of %d";
"Common.Controls.Status.MetaEntity.Email" = "Email address: %@";
"Common.Controls.Status.MetaEntity.Hashtag" = "Hashtag: %@";
"Common.Controls.Status.MetaEntity.Mention" = "Show Profile: %@";

View File

@ -128,15 +128,15 @@ extension MediaView {
case .image(let info):
layoutImage()
bindImage(configuration: configuration, info: info)
accessibilityHint = "Expands the image. Double-tap and hold to show actions" // TODO: i18n
accessibilityHint = L10n.Common.Controls.Status.Media.expandImageHint
case .gif(let info):
layoutGIF()
bindGIF(configuration: configuration, info: info)
accessibilityHint = "Expands the GIF. Double-tap and hold to show actions" // TODO: i18n
accessibilityHint = L10n.Common.Controls.Status.Media.expandGifHint
case .video(let info):
layoutVideo()
bindVideo(configuration: configuration, info: info)
accessibilityHint = "Shows video player. Double-tap and hold to show actions" // TODO: i18n
accessibilityHint = L10n.Common.Controls.Status.Media.expandVideoHint
}
accessibilityTraits.insert([.button, .image])
@ -220,7 +220,7 @@ extension MediaView {
private func bindAlt(configuration: Configuration, altDescription: String?) {
if configuration.total > 1 {
accessibilityLabel = L10n.Common.Controls.Status.mediaLabel(
accessibilityLabel = L10n.Common.Controls.Status.Media.accessibilityLabel(
altDescription ?? "",
configuration.index + 1,
configuration.total