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> <key>a11y.plural.count.characters_left</key>
<dict> <dict>
<key>NSStringLocalizedFormatKey</key> <key>NSStringLocalizedFormatKey</key>
<string>%#@character_count@</string> <string>%#@character_count@ left</string>
<key>character_count</key> <key>character_count</key>
<dict> <dict>
<key>NSStringFormatSpecTypeKey</key> <key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string> <string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>ld</string>
<key>zero</key> <key>zero</key>
<string>no characters left</string> <string>no characters</string>
<key>one</key> <key>one</key>
<string>1 character left</string> <string>1 character</string>
<key>few</key> <key>few</key>
<string>%ld characters left</string> <string>%ld characters</string>
<key>many</key> <key>many</key>
<string>%ld characters left</string> <string>%ld characters</string>
<key>other</key> <key>other</key>
<string>%ld characters left</string> <string>%ld characters</string>
</dict> </dict>
</dict> </dict>
<key>plural.count.followed_by_and_mutual</key> <key>plural.count.followed_by_and_mutual</key>

View File

@ -50,6 +50,28 @@
<string>%ld characters</string> <string>%ld characters</string>
</dict> </dict>
</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> <key>plural.count.followed_by_and_mutual</key>
<dict> <dict>
<key>NSStringLocalizedFormatKey</key> <key>NSStringLocalizedFormatKey</key>

View File

@ -405,7 +405,9 @@
"custom_emoji_picker": "Custom Emoji Picker", "custom_emoji_picker": "Custom Emoji Picker",
"enable_content_warning": "Enable Content Warning", "enable_content_warning": "Enable Content Warning",
"disable_content_warning": "Disable 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": { "keyboard": {
"discard_post": "Discard Post", "discard_post": "Discard Post",

View File

@ -435,6 +435,12 @@ public enum L10n {
public static let disableContentWarning = L10n.tr("Localizable", "Scene.Compose.Accessibility.DisableContentWarning") public static let disableContentWarning = L10n.tr("Localizable", "Scene.Compose.Accessibility.DisableContentWarning")
/// Enable Content Warning /// Enable Content Warning
public static let enableContentWarning = L10n.tr("Localizable", "Scene.Compose.Accessibility.EnableContentWarning") 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 /// Post Visibility Menu
public static let postVisibilityMenu = L10n.tr("Localizable", "Scene.Compose.Accessibility.PostVisibilityMenu") public static let postVisibilityMenu = L10n.tr("Localizable", "Scene.Compose.Accessibility.PostVisibilityMenu")
/// Remove Poll /// Remove Poll
@ -1262,6 +1268,10 @@ public enum L10n {
public enum A11y { public enum A11y {
public enum Plural { public enum Plural {
public enum Count { 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@" /// Plural format key: "Input limit exceeds %#@character_count@"
public static func inputLimitExceeds(_ p1: Int) -> String { public static func inputLimitExceeds(_ p1: Int) -> String {
return L10n.tr("Localizable", "a11y.plural.count.input_limit_exceeds", p1) 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.CustomEmojiPicker" = "Custom Emoji Picker";
"Scene.Compose.Accessibility.DisableContentWarning" = "Disable Content Warning"; "Scene.Compose.Accessibility.DisableContentWarning" = "Disable Content Warning";
"Scene.Compose.Accessibility.EnableContentWarning" = "Enable 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.PostVisibilityMenu" = "Post Visibility Menu";
"Scene.Compose.Accessibility.PostingAs" = "Posting as %@";
"Scene.Compose.Accessibility.RemovePoll" = "Remove Poll"; "Scene.Compose.Accessibility.RemovePoll" = "Remove Poll";
"Scene.Compose.Attachment.AttachmentBroken" = "This %@ is broken and cant be "Scene.Compose.Attachment.AttachmentBroken" = "This %@ is broken and cant be
uploaded to Mastodon."; uploaded to Mastodon.";

View File

@ -50,6 +50,28 @@
<string>%ld characters</string> <string>%ld characters</string>
</dict> </dict>
</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> <key>plural.count.followed_by_and_mutual</key>
<dict> <dict>
<key>NSStringLocalizedFormatKey</key> <key>NSStringLocalizedFormatKey</key>

View File

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

View File

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