From d330e16da55be8de67c671aac93cb2637184f401 Mon Sep 17 00:00:00 2001 From: CMK Date: Tue, 10 Aug 2021 14:32:29 +0800 Subject: [PATCH 1/7] feat: add stringsdict for intents --- Mastodon.xcodeproj/project.pbxproj | 6 +++ .../xcschemes/xcschememanagement.plist | 8 +-- MastodonIntent/Intents.stringsdict | 54 +++++++++++++++++++ 3 files changed, 64 insertions(+), 4 deletions(-) create mode 100644 MastodonIntent/Intents.stringsdict diff --git a/Mastodon.xcodeproj/project.pbxproj b/Mastodon.xcodeproj/project.pbxproj index 5622470e..1649d4fe 100644 --- a/Mastodon.xcodeproj/project.pbxproj +++ b/Mastodon.xcodeproj/project.pbxproj @@ -420,6 +420,8 @@ DBA1DB80268F84F80052DB59 /* NotificationType.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBA1DB7F268F84F80052DB59 /* NotificationType.swift */; }; DBA465932696B495002B41DB /* APIService+WebFinger.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBA465922696B495002B41DB /* APIService+WebFinger.swift */; }; DBA465952696E387002B41DB /* AppPreference.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBA465942696E387002B41DB /* AppPreference.swift */; }; + DBA4B0F126C24EC80077136E /* Intents.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = DBA4B0F026C24EC80077136E /* Intents.stringsdict */; }; + DBA4B0F226C24EC80077136E /* Intents.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = DBA4B0F026C24EC80077136E /* Intents.stringsdict */; }; DBA5E7A3263AD0A3004598BB /* PhotoLibraryService.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBA5E7A2263AD0A3004598BB /* PhotoLibraryService.swift */; }; DBA5E7A5263BD28C004598BB /* ContextMenuImagePreviewViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBA5E7A4263BD28C004598BB /* ContextMenuImagePreviewViewModel.swift */; }; DBA5E7A9263BD3A4004598BB /* ContextMenuImagePreviewViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBA5E7A8263BD3A4004598BB /* ContextMenuImagePreviewViewController.swift */; }; @@ -1192,6 +1194,7 @@ DBA4B0ED26C153B10077136E /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = nl; path = nl.lproj/Localizable.stringsdict; sourceTree = ""; }; DBA4B0EE26C153B20077136E /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/Localizable.strings; sourceTree = ""; }; DBA4B0EF26C153B20077136E /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/InfoPlist.strings; sourceTree = ""; }; + DBA4B0F026C24EC80077136E /* Intents.stringsdict */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; path = Intents.stringsdict; sourceTree = ""; }; DBA5E7A2263AD0A3004598BB /* PhotoLibraryService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotoLibraryService.swift; sourceTree = ""; }; DBA5E7A4263BD28C004598BB /* ContextMenuImagePreviewViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContextMenuImagePreviewViewModel.swift; sourceTree = ""; }; DBA5E7A8263BD3A4004598BB /* ContextMenuImagePreviewViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContextMenuImagePreviewViewController.swift; sourceTree = ""; }; @@ -2633,6 +2636,7 @@ isa = PBXGroup; children = ( DB0009A926AEE5DC009B9D2D /* Intents.intentdefinition */, + DBA4B0F026C24EC80077136E /* Intents.stringsdict */, DB8FABD626AEC864008E5AF4 /* MastodonIntent.entitlements */, DB8FABC926AEC7B2008E5AF4 /* IntentHandler.swift */, DBB8AB4526AECDE200F6D281 /* SendPostIntentHandler.swift */, @@ -3401,6 +3405,7 @@ DB3D100D25BAA75E00EAA174 /* Localizable.strings in Resources */, DB427DDF25BAA00100D1B89D /* Assets.xcassets in Resources */, DB427DDD25BAA00100D1B89D /* Main.storyboard in Resources */, + DBA4B0F126C24EC80077136E /* Intents.stringsdict in Resources */, DB118A8225E4B6E600FAB162 /* Preview Assets.xcassets in Resources */, DB2B3ABC25E37E15007045F9 /* InfoPlist.strings in Resources */, DB68A05D25E9055900CFDF14 /* Settings.bundle in Resources */, @@ -3446,6 +3451,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + DBA4B0F226C24EC80077136E /* Intents.stringsdict in Resources */, DBB8AB4F26AED13F00F6D281 /* Assets.xcassets in Resources */, DBB8AB5126AED14600F6D281 /* Localizable.strings in Resources */, DBB8AB5026AED14400F6D281 /* Localizable.stringsdict in Resources */, diff --git a/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist b/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist index aa31690d..0071ec89 100644 --- a/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist @@ -7,12 +7,12 @@ AppShared.xcscheme_^#shared#^_ orderHint - 33 + 32 CoreDataStack.xcscheme_^#shared#^_ orderHint - 34 + 35 Mastodon - ASDK.xcscheme_^#shared#^_ @@ -87,7 +87,7 @@ MastodonIntent.xcscheme_^#shared#^_ orderHint - 32 + 34 MastodonIntents.xcscheme_^#shared#^_ @@ -107,7 +107,7 @@ ShareActionExtension.xcscheme_^#shared#^_ orderHint - 35 + 33 SuppressBuildableAutocreation diff --git a/MastodonIntent/Intents.stringsdict b/MastodonIntent/Intents.stringsdict new file mode 100644 index 00000000..5a39d5e6 --- /dev/null +++ b/MastodonIntent/Intents.stringsdict @@ -0,0 +1,54 @@ + + + + + There are ${count} options matching ‘${content}’. - 2 + + NSStringLocalizedFormatKey + There are %#@count_option@ matching ‘${content}’. + count_option + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + %ld + zero + 0 options + one + 1 option + two + 2 options + few + %ld options + many + %ld options + other + %ld options + + + There are ${count} options matching ‘${visibility}’. + + NSStringLocalizedFormatKey + There are %#@count_option@ matching ‘${visibility}’. + count_option + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + %ld + zero + 0 options + one + 1 option + two + 2 options + few + %ld options + many + %ld options + other + %ld options + + + + From f3a03c4011bd3f149b839aa7406a593a8c8a682b Mon Sep 17 00:00:00 2001 From: CMK Date: Tue, 10 Aug 2021 15:40:44 +0800 Subject: [PATCH 2/7] chore: update intents strings --- Mastodon.xcodeproj/project.pbxproj | 4 ++-- .../xcschemes/xcschememanagement.plist | 8 ++++---- MastodonIntent/Base.lproj/Intents.intentdefinition | 10 ++++------ MastodonIntent/en.lproj/Intents.strings | 4 ++-- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/Mastodon.xcodeproj/project.pbxproj b/Mastodon.xcodeproj/project.pbxproj index 1649d4fe..10c0bf17 100644 --- a/Mastodon.xcodeproj/project.pbxproj +++ b/Mastodon.xcodeproj/project.pbxproj @@ -922,7 +922,6 @@ CD92E0F10BDE4FE7C4B999F2 /* Pods_MastodonTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_MastodonTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; D7D7CF93E262178800077512 /* Pods-Mastodon-AppShared.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Mastodon-AppShared.debug.xcconfig"; path = "Target Support Files/Pods-Mastodon-AppShared/Pods-Mastodon-AppShared.debug.xcconfig"; sourceTree = ""; }; DB0009A826AEE5DC009B9D2D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.intentdefinition; name = Base; path = Base.lproj/Intents.intentdefinition; sourceTree = ""; }; - DB0009AB26AEE5E3009B9D2D /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Intents.strings; sourceTree = ""; }; DB0009AD26AEE5E4009B9D2D /* ar */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ar; path = ar.lproj/Intents.strings; sourceTree = ""; }; DB0140CE25C42AEE00F9F3CF /* OSLog.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OSLog.swift; sourceTree = ""; }; DB023294267F0AB800031745 /* ASMetaEditableTextNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ASMetaEditableTextNode.swift; sourceTree = ""; }; @@ -1195,6 +1194,7 @@ DBA4B0EE26C153B20077136E /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/Localizable.strings; sourceTree = ""; }; DBA4B0EF26C153B20077136E /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/InfoPlist.strings; sourceTree = ""; }; DBA4B0F026C24EC80077136E /* Intents.stringsdict */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; path = Intents.stringsdict; sourceTree = ""; }; + DBA4B0F526C2621D0077136E /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Intents.strings; sourceTree = ""; }; DBA5E7A2263AD0A3004598BB /* PhotoLibraryService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotoLibraryService.swift; sourceTree = ""; }; DBA5E7A4263BD28C004598BB /* ContextMenuImagePreviewViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContextMenuImagePreviewViewModel.swift; sourceTree = ""; }; DBA5E7A8263BD3A4004598BB /* ContextMenuImagePreviewViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContextMenuImagePreviewViewController.swift; sourceTree = ""; }; @@ -4343,7 +4343,6 @@ isa = PBXVariantGroup; children = ( DB0009A826AEE5DC009B9D2D /* Base */, - DB0009AB26AEE5E3009B9D2D /* en */, DB0009AD26AEE5E4009B9D2D /* ar */, E9AABD3D26B64B8C00E237DA /* ja */, DBA4B0D326BD10AC0077136E /* zh-Hans */, @@ -4353,6 +4352,7 @@ DBA4B0E326BD11D10077136E /* es-419 */, DBA4B0E826C153820077136E /* de */, DBA4B0EC26C153B10077136E /* nl */, + DBA4B0F526C2621D0077136E /* en */, ); name = Intents.intentdefinition; sourceTree = ""; diff --git a/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist b/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist index 0071ec89..22e216ce 100644 --- a/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist @@ -7,12 +7,12 @@ AppShared.xcscheme_^#shared#^_ orderHint - 32 + 35 CoreDataStack.xcscheme_^#shared#^_ orderHint - 35 + 33 Mastodon - ASDK.xcscheme_^#shared#^_ @@ -87,7 +87,7 @@ MastodonIntent.xcscheme_^#shared#^_ orderHint - 34 + 32 MastodonIntents.xcscheme_^#shared#^_ @@ -107,7 +107,7 @@ ShareActionExtension.xcscheme_^#shared#^_ orderHint - 33 + 34 SuppressBuildableAutocreation diff --git a/MastodonIntent/Base.lproj/Intents.intentdefinition b/MastodonIntent/Base.lproj/Intents.intentdefinition index df98e3ab..6ccb0318 100644 --- a/MastodonIntent/Base.lproj/Intents.intentdefinition +++ b/MastodonIntent/Base.lproj/Intents.intentdefinition @@ -53,7 +53,7 @@ INIntentDefinitionNamespace BvMBE4 INIntentDefinitionSystemVersion - 20G71 + 20G80 INIntentDefinitionToolsBuildVersion 12E507 INIntentDefinitionToolsVersion @@ -85,8 +85,6 @@ Post ${content} on Mastodon INIntentParameterCombinationTitleID WCIR3D - INIntentParameterCombinationUpdatesLinked - INIntentName @@ -102,7 +100,7 @@ INIntentParameterCombinationSupportsBackgroundExecution INIntentParameterCombinationTitle - Post + Post on Mastodon INIntentParameterCombinationTitleID CsR7G2 @@ -117,7 +115,7 @@ INIntentParameterCombinationSupportsBackgroundExecution INIntentParameterCombinationTitle - Post + Post on Mastodon INIntentParameterCombinationTitleID dUyuGg @@ -247,7 +245,7 @@ INIntentResponseCodeConciseFormatStringID k7dbKQ INIntentResponseCodeFormatString - Post was sent successfully. + Post was sent successfully. INIntentResponseCodeFormatStringID ryJLwG INIntentResponseCodeName diff --git a/MastodonIntent/en.lproj/Intents.strings b/MastodonIntent/en.lproj/Intents.strings index e1906979..6877490b 100644 --- a/MastodonIntent/en.lproj/Intents.strings +++ b/MastodonIntent/en.lproj/Intents.strings @@ -2,7 +2,7 @@ "751xkl" = "Text Content"; -"CsR7G2" = "Post"; +"CsR7G2" = "Post on Mastodon"; "HZSGTr" = "What content to post?"; @@ -32,7 +32,7 @@ "ayoYEb-ehFLjY" = "${content}, Followers Only"; -"dUyuGg" = "Post"; +"dUyuGg" = "Post on Mastodon"; "dYQ5NN" = "Public"; From 0e9165f9e8c2848eedbf9bb0e6f12e2b0e16e41d Mon Sep 17 00:00:00 2001 From: CMK Date: Tue, 10 Aug 2021 16:02:51 +0800 Subject: [PATCH 3/7] chore: add intents strings dict to Crowdin configuration. --- .../Intents.stringsdict | 0 Mastodon.xcodeproj/project.pbxproj | 20 ++++--- MastodonIntent/en.lproj/Intents.stringsdict | 54 +++++++++++++++++++ crowdin.yml | 12 ++++- 4 files changed, 79 insertions(+), 7 deletions(-) rename {MastodonIntent => Localization}/Intents.stringsdict (100%) create mode 100644 MastodonIntent/en.lproj/Intents.stringsdict diff --git a/MastodonIntent/Intents.stringsdict b/Localization/Intents.stringsdict similarity index 100% rename from MastodonIntent/Intents.stringsdict rename to Localization/Intents.stringsdict diff --git a/Mastodon.xcodeproj/project.pbxproj b/Mastodon.xcodeproj/project.pbxproj index 10c0bf17..e9267885 100644 --- a/Mastodon.xcodeproj/project.pbxproj +++ b/Mastodon.xcodeproj/project.pbxproj @@ -420,8 +420,8 @@ DBA1DB80268F84F80052DB59 /* NotificationType.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBA1DB7F268F84F80052DB59 /* NotificationType.swift */; }; DBA465932696B495002B41DB /* APIService+WebFinger.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBA465922696B495002B41DB /* APIService+WebFinger.swift */; }; DBA465952696E387002B41DB /* AppPreference.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBA465942696E387002B41DB /* AppPreference.swift */; }; - DBA4B0F126C24EC80077136E /* Intents.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = DBA4B0F026C24EC80077136E /* Intents.stringsdict */; }; - DBA4B0F226C24EC80077136E /* Intents.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = DBA4B0F026C24EC80077136E /* Intents.stringsdict */; }; + DBA4B0F626C269880077136E /* Intents.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = DBA4B0F926C269880077136E /* Intents.stringsdict */; }; + DBA4B0F726C269880077136E /* Intents.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = DBA4B0F926C269880077136E /* Intents.stringsdict */; }; DBA5E7A3263AD0A3004598BB /* PhotoLibraryService.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBA5E7A2263AD0A3004598BB /* PhotoLibraryService.swift */; }; DBA5E7A5263BD28C004598BB /* ContextMenuImagePreviewViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBA5E7A4263BD28C004598BB /* ContextMenuImagePreviewViewModel.swift */; }; DBA5E7A9263BD3A4004598BB /* ContextMenuImagePreviewViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBA5E7A8263BD3A4004598BB /* ContextMenuImagePreviewViewController.swift */; }; @@ -1193,8 +1193,8 @@ DBA4B0ED26C153B10077136E /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = nl; path = nl.lproj/Localizable.stringsdict; sourceTree = ""; }; DBA4B0EE26C153B20077136E /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/Localizable.strings; sourceTree = ""; }; DBA4B0EF26C153B20077136E /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/InfoPlist.strings; sourceTree = ""; }; - DBA4B0F026C24EC80077136E /* Intents.stringsdict */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; path = Intents.stringsdict; sourceTree = ""; }; DBA4B0F526C2621D0077136E /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Intents.strings; sourceTree = ""; }; + DBA4B0F826C269880077136E /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = en; path = en.lproj/Intents.stringsdict; sourceTree = ""; }; DBA5E7A2263AD0A3004598BB /* PhotoLibraryService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotoLibraryService.swift; sourceTree = ""; }; DBA5E7A4263BD28C004598BB /* ContextMenuImagePreviewViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContextMenuImagePreviewViewModel.swift; sourceTree = ""; }; DBA5E7A8263BD3A4004598BB /* ContextMenuImagePreviewViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContextMenuImagePreviewViewController.swift; sourceTree = ""; }; @@ -2636,7 +2636,7 @@ isa = PBXGroup; children = ( DB0009A926AEE5DC009B9D2D /* Intents.intentdefinition */, - DBA4B0F026C24EC80077136E /* Intents.stringsdict */, + DBA4B0F926C269880077136E /* Intents.stringsdict */, DB8FABD626AEC864008E5AF4 /* MastodonIntent.entitlements */, DB8FABC926AEC7B2008E5AF4 /* IntentHandler.swift */, DBB8AB4526AECDE200F6D281 /* SendPostIntentHandler.swift */, @@ -3405,7 +3405,7 @@ DB3D100D25BAA75E00EAA174 /* Localizable.strings in Resources */, DB427DDF25BAA00100D1B89D /* Assets.xcassets in Resources */, DB427DDD25BAA00100D1B89D /* Main.storyboard in Resources */, - DBA4B0F126C24EC80077136E /* Intents.stringsdict in Resources */, + DBA4B0F626C269880077136E /* Intents.stringsdict in Resources */, DB118A8225E4B6E600FAB162 /* Preview Assets.xcassets in Resources */, DB2B3ABC25E37E15007045F9 /* InfoPlist.strings in Resources */, DB68A05D25E9055900CFDF14 /* Settings.bundle in Resources */, @@ -3451,7 +3451,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - DBA4B0F226C24EC80077136E /* Intents.stringsdict in Resources */, + DBA4B0F726C269880077136E /* Intents.stringsdict in Resources */, DBB8AB4F26AED13F00F6D281 /* Assets.xcassets in Resources */, DBB8AB5126AED14600F6D281 /* Localizable.strings in Resources */, DBB8AB5026AED14400F6D281 /* Localizable.stringsdict in Resources */, @@ -4424,6 +4424,14 @@ name = Localizable.stringsdict; sourceTree = ""; }; + DBA4B0F926C269880077136E /* Intents.stringsdict */ = { + isa = PBXVariantGroup; + children = ( + DBA4B0F826C269880077136E /* en */, + ); + name = Intents.stringsdict; + sourceTree = ""; + }; DBC6461626A170AB00B0E31B /* MainInterface.storyboard */ = { isa = PBXVariantGroup; children = ( diff --git a/MastodonIntent/en.lproj/Intents.stringsdict b/MastodonIntent/en.lproj/Intents.stringsdict new file mode 100644 index 00000000..5a39d5e6 --- /dev/null +++ b/MastodonIntent/en.lproj/Intents.stringsdict @@ -0,0 +1,54 @@ + + + + + There are ${count} options matching ‘${content}’. - 2 + + NSStringLocalizedFormatKey + There are %#@count_option@ matching ‘${content}’. + count_option + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + %ld + zero + 0 options + one + 1 option + two + 2 options + few + %ld options + many + %ld options + other + %ld options + + + There are ${count} options matching ‘${visibility}’. + + NSStringLocalizedFormatKey + There are %#@count_option@ matching ‘${visibility}’. + count_option + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + %ld + zero + 0 options + one + 1 option + two + 2 options + few + %ld options + many + %ld options + other + %ld options + + + + diff --git a/crowdin.yml b/crowdin.yml index 3612e371..38421efa 100644 --- a/crowdin.yml +++ b/crowdin.yml @@ -7,6 +7,7 @@ files: [ # Source files filter # e.g. "/resources/en/*.json" # + # App strings template "source" : "/Localization/app.json", # @@ -23,18 +24,27 @@ files: [ # }, { + # App info plist strings template "source" : "/Localization/ios-infoPlist.json", "translation" : "/Localization/StringsConvertor/input/%locale_with_underscore%/%original_file_name%", "update_option" : "update_as_unapproved", }, { + # App strings dict "source" : "/Localization/Localizable.stringsdict", "translation" : "/Localization/StringsConvertor/input/%locale_with_underscore%/%original_file_name%", "update_option" : "update_as_unapproved", }, { + # intents strings "source" : "/MastodonIntent/en.lproj/Intents.strings", "translation" : "/Localization/StringsConvertor/Intents/input/%locale_with_underscore%/%original_file_name%", "update_option" : "update_as_unapproved", - } + }, + { + # intents strings dict + "source" : "/MastodonIntent/en.lproj/Intents.stringsdict", + "translation" : "/Localization/StringsConvertor/Intents/input/%locale_with_underscore%/%original_file_name%", + "update_option" : "update_as_unapproved", + }, ] \ No newline at end of file From 65ac4c4b2bb4ec3a92ad13908d2897d540d8dc83 Mon Sep 17 00:00:00 2001 From: CMK Date: Tue, 10 Aug 2021 18:33:13 +0800 Subject: [PATCH 4/7] chore: adapt notification title label to i18n string --- Mastodon.xcodeproj/project.pbxproj | 2 +- .../xcschemes/xcschememanagement.plist | 6 ++-- .../xcshareddata/swiftpm/Package.resolved | 4 +-- .../Section/Status/NotificationSection.swift | 28 ++++++++++++++----- Mastodon/Extension/MetaLabel.swift | 10 +++---- .../NotificationStatusTableViewCell.swift | 26 ++++++----------- 6 files changed, 41 insertions(+), 35 deletions(-) diff --git a/Mastodon.xcodeproj/project.pbxproj b/Mastodon.xcodeproj/project.pbxproj index e9267885..1b6b3747 100644 --- a/Mastodon.xcodeproj/project.pbxproj +++ b/Mastodon.xcodeproj/project.pbxproj @@ -5715,7 +5715,7 @@ repositoryURL = "https://github.com/TwidereProject/MetaTextKit.git"; requirement = { kind = exactVersion; - version = 2.1.0; + version = 2.1.1; }; }; DB0E2D2C26833FF600865C3C /* XCRemoteSwiftPackageReference "Nuke-FLAnimatedImage-Plugin" */ = { diff --git a/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist b/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist index 22e216ce..fc6bfd20 100644 --- a/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist @@ -12,7 +12,7 @@ CoreDataStack.xcscheme_^#shared#^_ orderHint - 33 + 32 Mastodon - ASDK.xcscheme_^#shared#^_ @@ -87,7 +87,7 @@ MastodonIntent.xcscheme_^#shared#^_ orderHint - 32 + 34 MastodonIntents.xcscheme_^#shared#^_ @@ -107,7 +107,7 @@ ShareActionExtension.xcscheme_^#shared#^_ orderHint - 34 + 33 SuppressBuildableAutocreation diff --git a/Mastodon.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Mastodon.xcworkspace/xcshareddata/swiftpm/Package.resolved index 8e5ea37a..0dc724de 100644 --- a/Mastodon.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Mastodon.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -96,8 +96,8 @@ "repositoryURL": "https://github.com/TwidereProject/MetaTextKit.git", "state": { "branch": null, - "revision": "ccb54189b31d13868d979c33d43566912b765bbd", - "version": "2.1.0" + "revision": "a5f412b72fc08cd1348e2388fc7ec326365e1823", + "version": "2.1.1" } }, { diff --git a/Mastodon/Diffiable/Section/Status/NotificationSection.swift b/Mastodon/Diffiable/Section/Status/NotificationSection.swift index 79e31229..11dba214 100644 --- a/Mastodon/Diffiable/Section/Status/NotificationSection.swift +++ b/Mastodon/Diffiable/Section/Status/NotificationSection.swift @@ -68,23 +68,37 @@ extension NotificationSection { .store(in: &cell.disposeBag) // configure author name, notification description, timestamp + let nameText = notification.account.displayNameWithFallback + let titleLabelText = "\(nameText) \(notification.notificationType.actionText)" + do { - let mastodonContent = MastodonContent(content: notification.account.displayNameWithFallback, emojis: notification.account.emojiMeta) + let nameContent = MastodonContent(content: nameText, emojis: notification.account.emojiMeta) + let nameMetaContent = try MastodonMetaContent.convert(document: nameContent) + + let mastodonContent = MastodonContent(content: titleLabelText, emojis: notification.account.emojiMeta) let metaContent = try MastodonMetaContent.convert(document: mastodonContent) - cell.nameLabel.configure(content: metaContent) + + cell.titleLabel.configure(content: metaContent) + + if let nameRange = metaContent.string.range(of: nameMetaContent.string) { + let nsRange = NSRange(nameRange, in: metaContent.string) + cell.titleLabel.textStorage.addAttributes([ + .font: UIFontMetrics(forTextStyle: .headline).scaledFont(for: .systemFont(ofSize: 15, weight: .semibold), maximumPointSize: 20), + .foregroundColor: Asset.Colors.brandBlue.color, + ], range: nsRange) + } + } catch { - let metaContent = PlaintextMetaContent(string: notification.account.displayNameWithFallback) - cell.nameLabel.configure(content: metaContent) + let metaContent = PlaintextMetaContent(string: titleLabelText) + cell.titleLabel.configure(content: metaContent) } + let createAt = notification.createAt - let actionText = notification.notificationType.actionText - cell.actionLabel.text = actionText cell.timestampLabel.text = createAt.localizedTimeAgoSinceNow AppContext.shared.timestampUpdatePublisher .receive(on: DispatchQueue.main) .sink { [weak cell] _ in guard let cell = cell else { return } - cell.actionLabel.text = actionText cell.timestampLabel.text = createAt.localizedTimeAgoSinceNow } .store(in: &cell.disposeBag) diff --git a/Mastodon/Extension/MetaLabel.swift b/Mastodon/Extension/MetaLabel.swift index 8163a10c..9e7920a8 100644 --- a/Mastodon/Extension/MetaLabel.swift +++ b/Mastodon/Extension/MetaLabel.swift @@ -13,7 +13,7 @@ extension MetaLabel { enum Style { case statusHeader case statusName - case notificationName + case notificationTitle case profileFieldName case profileFieldValue case recommendAccountName @@ -26,6 +26,7 @@ extension MetaLabel { self.init() layer.masksToBounds = true + lineBreakMode = .byTruncatingTail textContainer.lineBreakMode = .byTruncatingTail textContainer.lineFragmentPadding = 0 @@ -41,9 +42,9 @@ extension MetaLabel { font = .systemFont(ofSize: 17, weight: .semibold) textColor = Asset.Colors.Label.primary.color - case .notificationName: - font = UIFontMetrics(forTextStyle: .headline).scaledFont(for: .systemFont(ofSize: 15, weight: .semibold), maximumPointSize: 20) - textColor = Asset.Colors.brandBlue.color + case .notificationTitle: + font = UIFontMetrics(forTextStyle: .headline).scaledFont(for: .systemFont(ofSize: 15, weight: .regular), maximumPointSize: 20) + textColor = Asset.Colors.Label.secondary.color case .profileFieldName: font = UIFontMetrics(forTextStyle: .headline).scaledFont(for: .systemFont(ofSize: 17, weight: .semibold), maximumPointSize: 20) @@ -54,7 +55,6 @@ extension MetaLabel { textColor = Asset.Colors.Label.primary.color textAlignment = .right - case .titleView: font = .systemFont(ofSize: 17, weight: .semibold) textColor = Asset.Colors.Label.primary.color diff --git a/Mastodon/Scene/Notification/TableViewCell/NotificationStatusTableViewCell.swift b/Mastodon/Scene/Notification/TableViewCell/NotificationStatusTableViewCell.swift index 804fc081..1712468a 100644 --- a/Mastodon/Scene/Notification/TableViewCell/NotificationStatusTableViewCell.swift +++ b/Mastodon/Scene/Notification/TableViewCell/NotificationStatusTableViewCell.swift @@ -49,13 +49,8 @@ final class NotificationStatusTableViewCell: UITableViewCell, StatusCell { let contentStackView = UIStackView() - let actionLabel: UILabel = { - let label = UILabel() - label.textColor = Asset.Colors.Label.secondary.color - label.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 15, weight: .regular), maximumPointSize: 20) - label.lineBreakMode = .byTruncatingTail - return label - }() + let titleLabel = MetaLabel(style: .notificationTitle) + let dotLabel: UILabel = { let label = UILabel() label.textColor = Asset.Colors.Label.secondary.color @@ -70,7 +65,6 @@ final class NotificationStatusTableViewCell: UITableViewCell, StatusCell { return label }() - let nameLabel = MetaLabel(style: .notificationName) let buttonStackView = UIStackView() @@ -181,17 +175,15 @@ extension NotificationStatusTableViewCell { actionStackView.distribution = .fill actionStackView.spacing = 4 - actionStackView.addArrangedSubview(nameLabel) - actionStackView.addArrangedSubview(actionLabel) + actionStackView.addArrangedSubview(titleLabel) actionStackView.addArrangedSubview(dotLabel) actionStackView.addArrangedSubview(timestampLabel) let timestampPaddingView = UIView() actionStackView.addArrangedSubview(timestampPaddingView) - nameLabel.setContentHuggingPriority(.required - 3, for: .horizontal) - nameLabel.setContentHuggingPriority(.required - 1, for: .vertical) - nameLabel.setContentCompressionResistancePriority(.required - 3, for: .horizontal) - nameLabel.setContentCompressionResistancePriority(.required - 1, for: .vertical) - actionLabel.setContentHuggingPriority(.defaultLow, for: .horizontal) + titleLabel.setContentHuggingPriority(.required - 3, for: .horizontal) + titleLabel.setContentHuggingPriority(.required - 1, for: .vertical) + titleLabel.setContentCompressionResistancePriority(.required - 3, for: .horizontal) + titleLabel.setContentCompressionResistancePriority(.required - 1, for: .vertical) dotLabel.setContentHuggingPriority(.required - 2, for: .horizontal) dotLabel.setContentCompressionResistancePriority(.required - 2, for: .horizontal) timestampLabel.setContentHuggingPriority(.required - 1, for: .horizontal) @@ -255,7 +247,7 @@ extension NotificationStatusTableViewCell { avatarButton.addTarget(self, action: #selector(NotificationStatusTableViewCell.avatarButtonDidPressed(_:)), for: .touchUpInside) let authorNameLabelTapGestureRecognizer = UITapGestureRecognizer.singleTapGestureRecognizer authorNameLabelTapGestureRecognizer.addTarget(self, action: #selector(NotificationStatusTableViewCell.authorNameLabelTapGestureRecognizerHandler(_:))) - nameLabel.addGestureRecognizer(authorNameLabelTapGestureRecognizer) + titleLabel.addGestureRecognizer(authorNameLabelTapGestureRecognizer) resetSeparatorLineLayout() @@ -303,7 +295,7 @@ extension NotificationStatusTableViewCell { @objc private func authorNameLabelTapGestureRecognizerHandler(_ sender: UITapGestureRecognizer) { os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - delegate?.notificationStatusTableViewCell(self, authorNameLabelDidPressed: nameLabel) + delegate?.notificationStatusTableViewCell(self, authorNameLabelDidPressed: titleLabel) } } From 3a8d1fa61a7498ae3c7ae9227f86bfd30c1fe0a6 Mon Sep 17 00:00:00 2001 From: CMK Date: Tue, 10 Aug 2021 18:38:39 +0800 Subject: [PATCH 5/7] chore: update i18n template for notification title --- Localization/app.json | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Localization/app.json b/Localization/app.json index d7ba2147..b60ade9c 100644 --- a/Localization/app.json +++ b/Localization/app.json @@ -454,14 +454,12 @@ "Everything": "Everything", "Mentions": "Mentions" }, - "action": { - "follow": "followed you", - "favourite": "favorited your post", - "reblog": "reblogged your post", - "poll": "Your poll has ended", - "mention": "mentioned you", - "follow_request": "requested to follow you" - }, + "user_followed_you": "%s followed you", + "user_favorited your post": "%s favorited your post", + "user_reblogged_your_post": "%s reblogged your post", + "user_mentioned_you": "%s mentioned you", + "user_requested_to_follow_you": "%s requested to follow you", + "user_your_poll_has_ended": "%s Your poll has ended", "keyobard": { "show_everything": "Show Everything", "show_mentions": "Show Mentions" From f495b16464f38531381c2f988c8f871b174de265 Mon Sep 17 00:00:00 2001 From: CMK Date: Tue, 10 Aug 2021 18:50:41 +0800 Subject: [PATCH 6/7] fix: status meta label in thread may get trimmed issue --- Mastodon/Scene/Share/View/Content/ThreadMetaView.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Mastodon/Scene/Share/View/Content/ThreadMetaView.swift b/Mastodon/Scene/Share/View/Content/ThreadMetaView.swift index ff2f94a0..d6f1b01a 100644 --- a/Mastodon/Scene/Share/View/Content/ThreadMetaView.swift +++ b/Mastodon/Scene/Share/View/Content/ThreadMetaView.swift @@ -13,6 +13,8 @@ final class ThreadMetaView: UIView { let label = UILabel() label.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 15, weight: .regular)) label.text = "Date" + label.adjustsFontSizeToFitWidth = true + label.minimumScaleFactor = 0.5 return label }() @@ -75,8 +77,10 @@ extension ThreadMetaView { actionButtonStackView.addArrangedSubview(favoriteButton) dateLabel.setContentHuggingPriority(.defaultLow, for: .horizontal) - reblogButton.setContentHuggingPriority(.required - 2, for: .horizontal) - favoriteButton.setContentHuggingPriority(.required - 1, for: .horizontal) + reblogButton.titleLabel?.setContentHuggingPriority(.required - 2, for: .horizontal) + favoriteButton.titleLabel?.setContentHuggingPriority(.required - 1, for: .horizontal) + reblogButton.setContentCompressionResistancePriority(.required - 2, for: .horizontal) + favoriteButton.setContentCompressionResistancePriority(.required - 1, for: .horizontal) updateContainerLayout() From 3819daede577814d1ee942cbef967b06372bf612 Mon Sep 17 00:00:00 2001 From: CMK Date: Tue, 10 Aug 2021 18:55:15 +0800 Subject: [PATCH 7/7] fix: content warning layout issue under zoomed display mode. resolve #277 --- Mastodon/Scene/Share/View/Content/StatusView.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Mastodon/Scene/Share/View/Content/StatusView.swift b/Mastodon/Scene/Share/View/Content/StatusView.swift index 664939fc..7afabd3a 100644 --- a/Mastodon/Scene/Share/View/Content/StatusView.swift +++ b/Mastodon/Scene/Share/View/Content/StatusView.swift @@ -386,10 +386,10 @@ extension StatusView { contentWarningOverlayView.translatesAutoresizingMaskIntoConstraints = false containerStackView.addSubview(contentWarningOverlayView) NSLayoutConstraint.activate([ - statusContainerStackView.topAnchor.constraint(equalTo: contentWarningOverlayView.topAnchor).priority(.defaultHigh + 10), - statusContainerStackView.leftAnchor.constraint(equalTo: contentWarningOverlayView.leftAnchor).priority(.defaultHigh), - contentWarningOverlayView.rightAnchor.constraint(equalTo: statusContainerStackView.rightAnchor).priority(.defaultHigh), - contentWarningOverlayView.bottomAnchor.constraint(equalTo: statusContainerStackView.bottomAnchor).priority(.defaultHigh), + statusContainerStackView.topAnchor.constraint(equalTo: contentWarningOverlayView.topAnchor).priority(.required - 10), + statusContainerStackView.leftAnchor.constraint(equalTo: contentWarningOverlayView.leftAnchor).priority(.required - 1), + contentWarningOverlayView.rightAnchor.constraint(equalTo: statusContainerStackView.rightAnchor).priority(.required - 1), + contentWarningOverlayView.bottomAnchor.constraint(equalTo: statusContainerStackView.bottomAnchor).priority(.required - 1), ]) // avoid overlay behind other views defer {