Skip to content

Commit c7d8cd8

Browse files
authored
Provide phrases for app intents (#114)
* Provide phrases for app intents * nit
1 parent e001cef commit c7d8cd8

File tree

6 files changed

+43
-5
lines changed

6 files changed

+43
-5
lines changed

MarkEdit.xcodeproj/project.pbxproj

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
87EB9901295755DA00A56B97 /* MarkEditCore in Frameworks */ = {isa = PBXBuildFile; productRef = 87EB9900295755DA00A56B97 /* MarkEditCore */; };
7575
87F2B5F429ACF56E0027103E /* EditorViewController+Completion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87F2B5F329ACF56E0027103E /* EditorViewController+Completion.swift */; };
7676
87F2B61429AF2F3A0027103E /* NSSpellChecker+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87F2B61329AF2F3A0027103E /* NSSpellChecker+Extension.swift */; };
77+
87F85D5929BC95AE00F3FD37 /* AppShortcuts.strings in Resources */ = {isa = PBXBuildFile; fileRef = 87F85D5729BC95AE00F3FD37 /* AppShortcuts.strings */; };
7778
/* End PBXBuildFile section */
7879

7980
/* Begin PBXContainerItemProxy section */
@@ -181,6 +182,8 @@
181182
87DE084A294E22C5004AD33A /* EditorViewController+TextFinder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "EditorViewController+TextFinder.swift"; sourceTree = "<group>"; };
182183
87F2B5F329ACF56E0027103E /* EditorViewController+Completion.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "EditorViewController+Completion.swift"; sourceTree = "<group>"; };
183184
87F2B61329AF2F3A0027103E /* NSSpellChecker+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSSpellChecker+Extension.swift"; sourceTree = "<group>"; };
185+
87F85D5829BC95AE00F3FD37 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/AppShortcuts.strings"; sourceTree = "<group>"; };
186+
87F85D5B29BC962100F3FD37 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/AppShortcuts.strings"; sourceTree = "<group>"; };
184187
/* End PBXFileReference section */
185188

186189
/* Begin PBXFrameworksBuildPhase section */
@@ -263,6 +266,7 @@
263266
870A51BE294702FD0095C7EB /* Info.plist */,
264267
870A51AE294700E00095C7EB /* Info.entitlements */,
265268
870A51AB294700E00095C7EB /* Main.storyboard */,
269+
87F85D5729BC95AE00F3FD37 /* AppShortcuts.strings */,
266270
);
267271
name = "Supporting Files";
268272
sourceTree = "<group>";
@@ -602,6 +606,7 @@
602606
buildActionMask = 2147483647;
603607
files = (
604608
870A51C9294752530095C7EB /* index.html in Resources */,
609+
87F85D5929BC95AE00F3FD37 /* AppShortcuts.strings in Resources */,
605610
873D6438295FEF220095DEF7 /* Localizable.strings in Resources */,
606611
870A51AA294700E00095C7EB /* Assets.xcassets in Resources */,
607612
870A51AD294700E00095C7EB /* Main.storyboard in Resources */,
@@ -747,6 +752,15 @@
747752
name = Localizable.strings;
748753
sourceTree = "<group>";
749754
};
755+
87F85D5729BC95AE00F3FD37 /* AppShortcuts.strings */ = {
756+
isa = PBXVariantGroup;
757+
children = (
758+
87F85D5829BC95AE00F3FD37 /* zh-Hans */,
759+
87F85D5B29BC962100F3FD37 /* zh-Hant */,
760+
);
761+
name = AppShortcuts.strings;
762+
sourceTree = "<group>";
763+
};
750764
/* End PBXVariantGroup section */
751765

752766
/* Begin XCBuildConfiguration section */

MarkEditMac/Sources/Shortcuts/IntentProvider.swift

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,15 @@ import AppIntents
1111
struct IntentProvider: AppShortcutsProvider {
1212
static var appShortcuts: [AppShortcut] {
1313
return [
14-
AppShortcut(intent: CreateNewDocumentIntent(), phrases: []),
15-
AppShortcut(intent: GetFileContentIntent(), phrases: []),
16-
AppShortcut(intent: UpdateFileContentIntent(), phrases: []),
14+
AppShortcut(intent: CreateNewDocumentIntent(), phrases: [
15+
"Create New Document in \(.applicationName)",
16+
]),
17+
AppShortcut(intent: GetFileContentIntent(), phrases: [
18+
"Get File Content in \(.applicationName)",
19+
]),
20+
AppShortcut(intent: UpdateFileContentIntent(), phrases: [
21+
"Update File Content in \(.applicationName)",
22+
]),
1723
]
1824
}
1925
}

MarkEditMac/Sources/Shortcuts/Intents/CreateNewDocumentIntent.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ struct CreateNewDocumentIntent: AppIntent {
3232
}
3333
}
3434

35-
return .result(value: true)
35+
return .result()
3636
}
3737
}

MarkEditMac/Sources/Shortcuts/Intents/UpdateFileContentIntent.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,6 @@ struct UpdateFileContentIntent: AppIntent {
6262
}
6363
}
6464

65-
return .result(value: true)
65+
return .result()
6666
}
6767
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* No comment provided by engineer. */
2+
"Create New Document in ${applicationName}" = "在 ${applicationName} 中创建新文档";
3+
4+
/* No comment provided by engineer. */
5+
"Get File Content in ${applicationName}" = "在 ${applicationName} 中获取文件内容";
6+
7+
/* No comment provided by engineer. */
8+
"Update File Content in ${applicationName}" = "在 ${applicationName} 中更新文件内容";
9+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* No comment provided by engineer. */
2+
"Create New Document in ${applicationName}" = "在 ${applicationName} 中建立新文件";
3+
4+
/* No comment provided by engineer. */
5+
"Get File Content in ${applicationName}" = "在 ${applicationName} 中獲取文件內容";
6+
7+
/* No comment provided by engineer. */
8+
"Update File Content in ${applicationName}" = "在 ${applicationName} 中更新文件內容";
9+

0 commit comments

Comments
 (0)