Add real localization keys

This commit is contained in:
Jed Fox 2022-11-08 13:50:23 -05:00
parent eef012678b
commit 60b69ca2e5
No known key found for this signature in database
GPG Key ID: 0B61D18EA54B47E1
8 changed files with 70 additions and 13 deletions

View File

@ -71,21 +71,23 @@
<key>a11y.plural.count.characters_left</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@character_count@</string>
<string>%#@character_count@ left</string>
<key>character_count</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>ld</string>
<key>zero</key>
<string>no characters left</string>
<string>no characters</string>
<key>one</key>
<string>1 character left</string>
<string>1 character</string>
<key>few</key>
<string>%ld characters left</string>
<string>%ld characters</string>
<key>many</key>
<string>%ld characters left</string>
<string>%ld characters</string>
<key>other</key>
<string>%ld characters left</string>
<string>%ld characters</string>
</dict>
</dict>
<key>plural.count.followed_by_and_mutual</key>

View File

@ -50,6 +50,28 @@
<string>%ld characters</string>
</dict>
</dict>
<key>a11y.plural.count.characters_left</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@character_count@ left</string>
<key>character_count</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>ld</string>
<key>zero</key>
<string>no characters</string>
<key>one</key>
<string>1 character</string>
<key>few</key>
<string>%ld characters</string>
<key>many</key>
<string>%ld characters</string>
<key>other</key>
<string>%ld characters</string>
</dict>
</dict>
<key>plural.count.followed_by_and_mutual</key>
<dict>
<key>NSStringLocalizedFormatKey</key>

View File

@ -405,7 +405,9 @@
"custom_emoji_picker": "Custom Emoji Picker",
"enable_content_warning": "Enable Content Warning",
"disable_content_warning": "Disable Content Warning",
"post_visibility_menu": "Post Visibility Menu"
"post_visibility_menu": "Post Visibility Menu",
"post_options": "Post Options",
"posting_as": "Posting as %s"
},
"keyboard": {
"discard_post": "Discard Post",

View File

@ -435,6 +435,12 @@ public enum L10n {
public static let disableContentWarning = L10n.tr("Localizable", "Scene.Compose.Accessibility.DisableContentWarning")
/// Enable Content Warning
public static let enableContentWarning = L10n.tr("Localizable", "Scene.Compose.Accessibility.EnableContentWarning")
/// Posting as %@
public static func postingAs(_ p1: Any) -> String {
return L10n.tr("Localizable", "Scene.Compose.Accessibility.PostingAs", String(describing: p1))
}
/// Post Options
public static let postOptions = L10n.tr("Localizable", "Scene.Compose.Accessibility.PostOptions")
/// Post Visibility Menu
public static let postVisibilityMenu = L10n.tr("Localizable", "Scene.Compose.Accessibility.PostVisibilityMenu")
/// Remove Poll
@ -1262,6 +1268,10 @@ public enum L10n {
public enum A11y {
public enum Plural {
public enum Count {
/// Plural format key: "%#@character_count@ left"
public static func charactersLeft(_ p1: Int) -> String {
return L10n.tr("Localizable", "a11y.plural.count.characters_left", p1)
}
/// Plural format key: "Input limit exceeds %#@character_count@"
public static func inputLimitExceeds(_ p1: Int) -> String {
return L10n.tr("Localizable", "a11y.plural.count.input_limit_exceeds", p1)

View File

@ -160,7 +160,9 @@ Your profile looks like this to them.";
"Scene.Compose.Accessibility.CustomEmojiPicker" = "Custom Emoji Picker";
"Scene.Compose.Accessibility.DisableContentWarning" = "Disable Content Warning";
"Scene.Compose.Accessibility.EnableContentWarning" = "Enable Content Warning";
"Scene.Compose.Accessibility.PostOptions" = "Post Options";
"Scene.Compose.Accessibility.PostVisibilityMenu" = "Post Visibility Menu";
"Scene.Compose.Accessibility.PostingAs" = "Posting as %@";
"Scene.Compose.Accessibility.RemovePoll" = "Remove Poll";
"Scene.Compose.Attachment.AttachmentBroken" = "This %@ is broken and cant be
uploaded to Mastodon.";

View File

@ -50,6 +50,28 @@
<string>%ld characters</string>
</dict>
</dict>
<key>a11y.plural.count.characters_left</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@character_count@ left</string>
<key>character_count</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>ld</string>
<key>zero</key>
<string>no characters</string>
<key>one</key>
<string>1 character</string>
<key>few</key>
<string>%ld characters</string>
<key>many</key>
<string>%ld characters</string>
<key>other</key>
<string>%ld characters</string>
</dict>
</dict>
<key>plural.count.followed_by_and_mutual</key>
<dict>
<key>NSStringLocalizedFormatKey</key>

View File

@ -87,16 +87,14 @@ struct ComposeContentToolbarView: View {
Text("\(remains)")
.foregroundColor(Color(isOverflow ? UIColor.systemRed : UIColor.secondaryLabel))
.font(.system(size: isOverflow ? 18 : 16, weight: isOverflow ? .medium : .regular))
// TODO: i18n (a11y.plural.count.characters_left)
.accessibilityLabel("\(remains) characters left")
.accessibilityLabel(L10n.A11y.Plural.Count.charactersLeft(remains))
}
.padding(.leading, 4) // 4 + 12 = 16
.padding(.trailing, 16)
.frame(height: ComposeContentToolbarView.toolbarHeight)
.background(Color(viewModel.backgroundColor))
.accessibilityElement(children: .contain)
// TODO: i18n (scene.compose.accessibility.post_options)
.accessibilityLabel("Post Options")
.accessibilityLabel(L10n.Scene.Compose.Accessibility.postOptions)
}
}

View File

@ -148,8 +148,7 @@ extension ComposeContentView {
Spacer()
}
.accessibilityElement(children: .ignore)
// TODO: i18n (scene.compose.accessibility.posting_as)
.accessibilityLabel("Posting as \([viewModel.name.string, viewModel.username].joined(separator: ", "))")
.accessibilityLabel(L10n.Scene.Compose.Accessibility.postingAs([viewModel.name.string, viewModel.username].joined(separator: ", ")))
}
}