Add localization info

This commit is contained in:
Jed Fox 2022-11-08 13:30:17 -05:00
parent d96f189980
commit 24c426f7f3
No known key found for this signature in database
GPG Key ID: 0B61D18EA54B47E1
5 changed files with 39 additions and 16 deletions

View File

@ -136,6 +136,12 @@
"vote": "Vote",
"closed": "Closed"
},
"meta_entity": {
"url": "Link: %s",
"hashtag": "Hastag %s",
"mention": "Show Profile: %s",
"email": "Email address: %s"
},
"actions": {
"reply": "Reply",
"reblog": "Reblog",

View File

@ -136,6 +136,12 @@
"vote": "Vote",
"closed": "Closed"
},
"meta_entity": {
"url": "Link: %s",
"hashtag": "Hastag %s",
"mention": "Show Profile: %s",
"email": "Email address: %s"
},
"actions": {
"reply": "Reply",
"reblog": "Reblog",
@ -685,13 +691,5 @@
"multiple_account_switch_intro_description": "Switch between multiple accounts by holding the profile button.",
"accessibility_hint": "Double tap to dismiss this wizard"
}
},
"a11y": {
"meta_entity": {
"url": "Link: %s",
"hashtag": "Hastag %s",
"mention": "Show Profile: %s",
"email": "Email address: %s",
}
}
}

View File

@ -314,6 +314,24 @@ public enum L10n {
/// Undo reblog
public static let unreblog = L10n.tr("Localizable", "Common.Controls.Status.Actions.Unreblog")
}
public enum MetaEntity {
/// Email address: %@
public static func email(_ p1: Any) -> String {
return L10n.tr("Localizable", "Common.Controls.Status.MetaEntity.Email", String(describing: p1))
}
/// Hastag %@
public static func hashtag(_ p1: Any) -> String {
return L10n.tr("Localizable", "Common.Controls.Status.MetaEntity.Hashtag", String(describing: p1))
}
/// Show Profile: %@
public static func mention(_ p1: Any) -> String {
return L10n.tr("Localizable", "Common.Controls.Status.MetaEntity.Mention", String(describing: p1))
}
/// Link: %@
public static func url(_ p1: Any) -> String {
return L10n.tr("Localizable", "Common.Controls.Status.MetaEntity.Url", String(describing: p1))
}
}
public enum Poll {
/// Closed
public static let closed = L10n.tr("Localizable", "Common.Controls.Status.Poll.Closed")

View File

@ -108,6 +108,10 @@ Please check your internet connection.";
"Common.Controls.Status.Actions.Unbookmark" = "Unbookmark";
"Common.Controls.Status.ContentWarning" = "Content Warning";
"Common.Controls.Status.MediaContentWarning" = "Tap anywhere to reveal";
"Common.Controls.Status.MetaEntity.Email" = "Email address: %@";
"Common.Controls.Status.MetaEntity.Hashtag" = "Hastag %@";
"Common.Controls.Status.MetaEntity.Mention" = "Show Profile: %@";
"Common.Controls.Status.MetaEntity.Url" = "Link: %@";
"Common.Controls.Status.Poll.Closed" = "Closed";
"Common.Controls.Status.Poll.Vote" = "Vote";
"Common.Controls.Status.SensitiveContent" = "Sensitive Content";

View File

@ -6,22 +6,19 @@
//
import Meta
import MastodonLocalization
extension Meta.Entity {
var accessibilityCustomActionLabel: String? {
switch meta {
case .url(_, trimmed: _, url: let url, userInfo: _):
// TODO: i18n (a11y.meta_entity.url)
return "Link: \(url)"
return L10n.Common.Controls.Status.MetaEntity.url(url)
case .hashtag(_, hashtag: let hashtag, userInfo: _):
// TODO: i18n (a11y.meta_entity.hashtag)
return "Hashtag \(hashtag)"
return L10n.Common.Controls.Status.MetaEntity.hashtag(hashtag)
case .mention(_, mention: let mention, userInfo: _):
// TODO: i18n (a11y.meta_entity.mention)
return "Show Profile: \("@" + mention)"
return L10n.Common.Controls.Status.MetaEntity.mention(mention)
case .email(let email, userInfo: _):
// TODO: i18n (a11y.meta_entity.email)
return "Email address: \(email)"
return L10n.Common.Controls.Status.MetaEntity.email(email)
// emoji are not actionable
case .emoji:
return nil