From 0b6c255454bb2667f132da42b0fea0567f47b31a Mon Sep 17 00:00:00 2001 From: groverlynn Date: Sat, 29 Oct 2022 22:21:33 +0200 Subject: [PATCH 1/3] Register squirrel into Cantonese --- Base.lproj/MainMenu.xib | 6 +-- Info.plist | 31 +++++++++++++++- Squirrel.xcodeproj/project.pbxproj | 7 ++++ en.lproj/InfoPlist.strings | 2 +- en.lproj/Localizable.strings | 14 +------ input_source.m | 13 +++++-- zh-HK.lproj/InfoPlist.strings | 11 ++++++ zh-HK.lproj/Localizable.strings | 13 +++++++ zh-HK.lproj/MainMenu.xib | 59 ++++++++++++++++++++++++++++++ zh-Hans.lproj/InfoPlist.strings | 3 +- zh-Hans.lproj/Localizable.strings | 10 ----- zh-Hans.lproj/MainMenu.xib | 6 +-- zh-Hant.lproj/InfoPlist.strings | 3 +- zh-Hant.lproj/Localizable.strings | 14 +------ zh-Hant.lproj/MainMenu.xib | 8 ++-- 15 files changed, 149 insertions(+), 51 deletions(-) create mode 100644 zh-HK.lproj/InfoPlist.strings create mode 100644 zh-HK.lproj/Localizable.strings create mode 100644 zh-HK.lproj/MainMenu.xib diff --git a/Base.lproj/MainMenu.xib b/Base.lproj/MainMenu.xib index 38859404b..af27279e8 100644 --- a/Base.lproj/MainMenu.xib +++ b/Base.lproj/MainMenu.xib @@ -34,19 +34,19 @@ - + - + - + diff --git a/Info.plist b/Info.plist index 0929d4c2e..f5b35c9e5 100644 --- a/Info.plist +++ b/Info.plist @@ -66,7 +66,33 @@ Hans tsInputModeDefaultStateKey - + + tsInputModeIsVisibleKey + + tsInputModeKeyEquivalentModifiersKey + 4608 + tsInputModeMenuIconFileKey + rime.pdf + tsInputModePaletteIconFileKey + rime.pdf + tsInputModePrimaryInScriptKey + + tsInputModeScriptKey + smUnicodeScript + + im.rime.inputmethod.Squirrel.Cant + + TISInputSourceID + im.rime.inputmethod.Squirrel.Cant + TISIntendedLanguage + yue-Hant + tsInputModeCharacterRepertoireKey + + Hant + Hans + + tsInputModeDefaultStateKey + tsInputModeIsVisibleKey tsInputModeKeyEquivalentModifiersKey @@ -85,6 +111,7 @@ im.rime.inputmethod.Squirrel.Hans im.rime.inputmethod.Squirrel.Hant + im.rime.inputmethod.Squirrel.Cant InputMethodConnectionName @@ -109,5 +136,7 @@ dsa_pub.pem TICapsLockLanguageSwitchCapable + tsInputMethodIconFileKey + rime.pdf diff --git a/Squirrel.xcodeproj/project.pbxproj b/Squirrel.xcodeproj/project.pbxproj index 6898ec0ae..5a9be8c2a 100644 --- a/Squirrel.xcodeproj/project.pbxproj +++ b/Squirrel.xcodeproj/project.pbxproj @@ -278,6 +278,9 @@ A4FC48CA0F6530EF0069BE81 /* en */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; D26434542706A15100857391 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; E93074B60A5C264700470842 /* InputMethodKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = InputMethodKit.framework; path = /System/Library/Frameworks/InputMethodKit.framework; sourceTree = ""; }; + F4A90994297F63AE00D9F520 /* zh-HK */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-HK"; path = "zh-HK.lproj/Localizable.strings"; sourceTree = ""; }; + F4A90995297F63AE00D9F520 /* zh-HK */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-HK"; path = "zh-HK.lproj/InfoPlist.strings"; sourceTree = ""; }; + F4A90996297F63AE00D9F520 /* zh-HK */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = "zh-HK"; path = "zh-HK.lproj/MainMenu.xib"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -515,6 +518,7 @@ en, "zh-Hans", "zh-Hant", + "zh-HK", Base, ); mainGroup = 29B97314FDCFA39411CA2CEA /* Squirrel */; @@ -570,6 +574,7 @@ 089C165DFE840E0CC02AAC07 /* en */, 446D18E014F0191200EC3116 /* zh-Hans */, 446D18E114F0193100EC3116 /* zh-Hant */, + F4A90995297F63AE00D9F520 /* zh-HK */, ); name = InfoPlist.strings; sourceTree = ""; @@ -579,6 +584,7 @@ children = ( 44DA191A152B8CB600FB8EF0 /* zh-Hans */, 44DA191B152B8CBC00FB8EF0 /* zh-Hant */, + F4A90996297F63AE00D9F520 /* zh-HK */, 44CB5E872585EFAE0022654F /* Base */, ); name = MainMenu.xib; @@ -590,6 +596,7 @@ A4FC48CA0F6530EF0069BE81 /* en */, 44FA4D891685997300116C1F /* zh-Hans */, 44FA4D8E16859B2900116C1F /* zh-Hant */, + F4A90994297F63AE00D9F520 /* zh-HK */, ); name = Localizable.strings; sourceTree = ""; diff --git a/en.lproj/InfoPlist.strings b/en.lproj/InfoPlist.strings index 937469500..80be30bae 100644 --- a/en.lproj/InfoPlist.strings +++ b/en.lproj/InfoPlist.strings @@ -1,6 +1,6 @@ /* Localized versions of Info.plist keys */ -NSHumanReadableCopyright = "Copyleft, RIME Developers"; +NSHumanReadableCopyright = "Copyleft 🄯 RIME Developers"; im.rime.inputmethod.Squirrel = "Squirrel"; im.rime.inputmethod.Squirrel.Hans = "Squirrel - Simplified"; diff --git a/en.lproj/Localizable.strings b/en.lproj/Localizable.strings index 5e91f7017..02184186b 100644 --- a/en.lproj/Localizable.strings +++ b/en.lproj/Localizable.strings @@ -1,16 +1,6 @@ "Squirrel" = "Squirrel"; -"deploy_update" = "Deploying Rime for updates."; -"deploy_start" = "Deploying Rime input method engine."; +"deploy_update" = "Deploying Rime for updates…"; +"deploy_start" = "Deploying Rime input method engine…"; "deploy_success" = "Squirrel is ready."; "deploy_failure" = "Error occurred. See log file $TMPDIR/rime.squirrel.INFO."; -"ascii_mode" = "A"; -"!ascii_mode" = "中"; -"full_shape" = "Full shape"; -"!full_shape" = "Half shape"; -"ascii_punct" = ".,"; -"!ascii_punct" = "。,"; -"simplification" = "Simplified"; -"!simplification" = "Traditional"; -"extended_charset" = "CJK extended"; -"!extended_charset" = "CJK baseset"; diff --git a/input_source.m b/input_source.m index 9118fe62f..213e2264d 100644 --- a/input_source.m +++ b/input_source.m @@ -6,9 +6,12 @@ @"im.rime.inputmethod.Squirrel.Hans"; static NSString *const kHantInputModeID = @"im.rime.inputmethod.Squirrel.Hant"; +static NSString *const kCantInputModeID = + @"im.rime.inputmethod.Squirrel.Cant"; #define HANS_INPUT_MODE (1 << 0) #define HANT_INPUT_MODE (1 << 1) +#define CANT_INPUT_MODE (1 << 2) void RegisterInputSource(void) { CFURLRef installedLocationURL = CFURLCreateFromFileSystemRepresentation( @@ -31,7 +34,9 @@ void ActivateInputSource(int enabled_modes) { if (([sourceID isEqualToString:kHansInputModeID] && ((enabled_modes & HANS_INPUT_MODE) != 0)) || ([sourceID isEqualToString:kHantInputModeID] && - ((enabled_modes & HANT_INPUT_MODE) != 0))) { + ((enabled_modes & HANT_INPUT_MODE) != 0)) || + ([sourceID isEqualToString:kCantInputModeID] && + ((enabled_modes & CANT_INPUT_MODE) != 0))) { TISEnableInputSource(inputSource); NSLog(@"Enabled input source: %@", sourceID); CFBooleanRef isSelectable = (CFBooleanRef)TISGetInputSourceProperty( @@ -54,7 +59,8 @@ void DeactivateInputSource(void) { inputSource, kTISPropertyInputSourceID)); //NSLog(@"Examining input source: %@", sourceID); if ([sourceID isEqualToString:kHansInputModeID] || - [sourceID isEqualToString:kHantInputModeID]) { + [sourceID isEqualToString:kHantInputModeID] || + [sourceID isEqualToString:kCantInputModeID]) { CFBooleanRef isEnabled = (CFBooleanRef)(TISGetInputSourceProperty( inputSource, kTISPropertyInputSourceIsEnabled)); if (CFBooleanGetValue(isEnabled)) { @@ -76,7 +82,8 @@ int GetEnabledInputModes(void) { inputSource, kTISPropertyInputSourceID)); //NSLog(@"Examining input source: %@", sourceID); if ([sourceID isEqualToString:kHansInputModeID] || - [sourceID isEqualToString:kHantInputModeID]) { + [sourceID isEqualToString:kHantInputModeID] || + [sourceID isEqualToString:kCantInputModeID]) { CFBooleanRef isEnabled = (CFBooleanRef)(TISGetInputSourceProperty( inputSource, kTISPropertyInputSourceIsEnabled)); if (CFBooleanGetValue(isEnabled)) { diff --git a/zh-HK.lproj/InfoPlist.strings b/zh-HK.lproj/InfoPlist.strings new file mode 100644 index 000000000..4e8f3bef3 --- /dev/null +++ b/zh-HK.lproj/InfoPlist.strings @@ -0,0 +1,11 @@ +/* Localized versions of Info.plist keys */ + +NSHumanReadableCopyright = "式恕堂🄯版權所無"; + +im.rime.inputmethod.Squirrel = "鼠鬚管"; +im.rime.inputmethod.Squirrel.Hans = "鼠须管"; +im.rime.inputmethod.Squirrel.Hant = "鼠鬚管"; +im.rime.inputmethod.Squirrel.Cant = "鼠鬚管"; + +CFBundleName = "鼠鬚管"; +CFBundleDisplayName = "鼠鬚管"; diff --git a/zh-HK.lproj/Localizable.strings b/zh-HK.lproj/Localizable.strings new file mode 100644 index 000000000..80748bebf --- /dev/null +++ b/zh-HK.lproj/Localizable.strings @@ -0,0 +1,13 @@ +/* + Localizable.strings + Squirrel + + Created by 弓辰 on 12/12/22. + +*/ +"Squirrel" = "鼠鬚管"; + +"deploy_update" = "更新輸入法引擎⋯"; +"deploy_start" = "部署輸入法引擎⋯"; +"deploy_success" = "部署完成。"; +"deploy_failure" = "有錯誤!請查看日誌 $TMPDIR/rime.squirrel.INFO"; diff --git a/zh-HK.lproj/MainMenu.xib b/zh-HK.lproj/MainMenu.xib new file mode 100644 index 000000000..722c6e1b2 --- /dev/null +++ b/zh-HK.lproj/MainMenu.xib @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/zh-Hans.lproj/InfoPlist.strings b/zh-Hans.lproj/InfoPlist.strings index 250343f91..4a06de222 100644 --- a/zh-Hans.lproj/InfoPlist.strings +++ b/zh-Hans.lproj/InfoPlist.strings @@ -1,10 +1,11 @@ /* Localized versions of Info.plist keys */ -NSHumanReadableCopyright = "式恕堂 版权所无"; +NSHumanReadableCopyright = "式恕堂🄯版权所无"; im.rime.inputmethod.Squirrel = "鼠须管"; im.rime.inputmethod.Squirrel.Hans = "鼠须管"; im.rime.inputmethod.Squirrel.Hant = "鼠鬚管"; +im.rime.inputmethod.Squirrel.Cant = "鼠鬚管"; CFBundleName = "鼠须管"; CFBundleDisplayName = "鼠须管"; diff --git a/zh-Hans.lproj/Localizable.strings b/zh-Hans.lproj/Localizable.strings index 7f49d70d4..b1b90801a 100644 --- a/zh-Hans.lproj/Localizable.strings +++ b/zh-Hans.lproj/Localizable.strings @@ -11,13 +11,3 @@ "deploy_start" = "部署输入法引擎…"; "deploy_success" = "部署完成。"; "deploy_failure" = "有错误!请查看日志 $TMPDIR/rime.squirrel.INFO"; -"ascii_mode" = "A"; -"!ascii_mode" = "中"; -"full_shape" = "全角"; -"!full_shape" = "半角"; -"ascii_punct" = ".,"; -"!ascii_punct" = "。,"; -"simplification" = "汉字"; -"!simplification" = "漢字"; -"extended_charset" = "增广"; -"!extended_charset" = "通用"; diff --git a/zh-Hans.lproj/MainMenu.xib b/zh-Hans.lproj/MainMenu.xib index e602c2e24..d7ccc616c 100644 --- a/zh-Hans.lproj/MainMenu.xib +++ b/zh-Hans.lproj/MainMenu.xib @@ -34,19 +34,19 @@ - + - + - + diff --git a/zh-Hant.lproj/InfoPlist.strings b/zh-Hant.lproj/InfoPlist.strings index 30cb1d9a9..4e8f3bef3 100644 --- a/zh-Hant.lproj/InfoPlist.strings +++ b/zh-Hant.lproj/InfoPlist.strings @@ -1,10 +1,11 @@ /* Localized versions of Info.plist keys */ -NSHumanReadableCopyright = "式恕堂 版權所無"; +NSHumanReadableCopyright = "式恕堂🄯版權所無"; im.rime.inputmethod.Squirrel = "鼠鬚管"; im.rime.inputmethod.Squirrel.Hans = "鼠须管"; im.rime.inputmethod.Squirrel.Hant = "鼠鬚管"; +im.rime.inputmethod.Squirrel.Cant = "鼠鬚管"; CFBundleName = "鼠鬚管"; CFBundleDisplayName = "鼠鬚管"; diff --git a/zh-Hant.lproj/Localizable.strings b/zh-Hant.lproj/Localizable.strings index 69ea17b32..80748bebf 100644 --- a/zh-Hant.lproj/Localizable.strings +++ b/zh-Hant.lproj/Localizable.strings @@ -7,17 +7,7 @@ */ "Squirrel" = "鼠鬚管"; -"deploy_update" = "更新輸入法引擎…"; -"deploy_start" = "部署輸入法引擎…"; +"deploy_update" = "更新輸入法引擎⋯"; +"deploy_start" = "部署輸入法引擎⋯"; "deploy_success" = "部署完成。"; "deploy_failure" = "有錯誤!請查看日誌 $TMPDIR/rime.squirrel.INFO"; -"ascii_mode" = "A"; -"!ascii_mode" = "中"; -"full_shape" = "全角"; -"!full_shape" = "半角"; -"ascii_punct" = ".,"; -"!ascii_punct" = "。,"; -"simplification" = "汉字"; -"!simplification" = "漢字"; -"extended_charset" = "增廣"; -"!extended_charset" = "通用"; diff --git a/zh-Hant.lproj/MainMenu.xib b/zh-Hant.lproj/MainMenu.xib index 893178260..829e72be4 100644 --- a/zh-Hant.lproj/MainMenu.xib +++ b/zh-Hant.lproj/MainMenu.xib @@ -28,25 +28,25 @@ - + - + - + - + From d55060957e99787fe7c9f5bec543d3855ae74156 Mon Sep 17 00:00:00 2001 From: groverlynn Date: Thu, 27 Apr 2023 22:12:01 +0200 Subject: [PATCH 2/3] distinguish hant and cant --- zh-HK.lproj/InfoPlist.strings | 8 ++++---- zh-HK.lproj/Localizable.strings | 2 +- zh-Hans.lproj/InfoPlist.strings | 2 +- zh-Hant.lproj/InfoPlist.strings | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/zh-HK.lproj/InfoPlist.strings b/zh-HK.lproj/InfoPlist.strings index 4e8f3bef3..2a7e36b3e 100644 --- a/zh-HK.lproj/InfoPlist.strings +++ b/zh-HK.lproj/InfoPlist.strings @@ -2,10 +2,10 @@ NSHumanReadableCopyright = "式恕堂🄯版權所無"; -im.rime.inputmethod.Squirrel = "鼠鬚管"; +im.rime.inputmethod.Squirrel = "鼠鬚筆"; im.rime.inputmethod.Squirrel.Hans = "鼠须管"; im.rime.inputmethod.Squirrel.Hant = "鼠鬚管"; -im.rime.inputmethod.Squirrel.Cant = "鼠鬚管"; +im.rime.inputmethod.Squirrel.Cant = "鼠鬚筆"; -CFBundleName = "鼠鬚管"; -CFBundleDisplayName = "鼠鬚管"; +CFBundleName = "鼠鬚筆"; +CFBundleDisplayName = "鼠鬚筆"; diff --git a/zh-HK.lproj/Localizable.strings b/zh-HK.lproj/Localizable.strings index 80748bebf..7d9d8c7e2 100644 --- a/zh-HK.lproj/Localizable.strings +++ b/zh-HK.lproj/Localizable.strings @@ -5,7 +5,7 @@ Created by 弓辰 on 12/12/22. */ -"Squirrel" = "鼠鬚管"; +"Squirrel" = "鼠鬚筆"; "deploy_update" = "更新輸入法引擎⋯"; "deploy_start" = "部署輸入法引擎⋯"; diff --git a/zh-Hans.lproj/InfoPlist.strings b/zh-Hans.lproj/InfoPlist.strings index 4a06de222..675a0ec7c 100644 --- a/zh-Hans.lproj/InfoPlist.strings +++ b/zh-Hans.lproj/InfoPlist.strings @@ -5,7 +5,7 @@ NSHumanReadableCopyright = "式恕堂🄯版权所无"; im.rime.inputmethod.Squirrel = "鼠须管"; im.rime.inputmethod.Squirrel.Hans = "鼠须管"; im.rime.inputmethod.Squirrel.Hant = "鼠鬚管"; -im.rime.inputmethod.Squirrel.Cant = "鼠鬚管"; +im.rime.inputmethod.Squirrel.Cant = "鼠鬚筆"; CFBundleName = "鼠须管"; CFBundleDisplayName = "鼠须管"; diff --git a/zh-Hant.lproj/InfoPlist.strings b/zh-Hant.lproj/InfoPlist.strings index 4e8f3bef3..ba8d5048a 100644 --- a/zh-Hant.lproj/InfoPlist.strings +++ b/zh-Hant.lproj/InfoPlist.strings @@ -5,7 +5,7 @@ NSHumanReadableCopyright = "式恕堂🄯版權所無"; im.rime.inputmethod.Squirrel = "鼠鬚管"; im.rime.inputmethod.Squirrel.Hans = "鼠须管"; im.rime.inputmethod.Squirrel.Hant = "鼠鬚管"; -im.rime.inputmethod.Squirrel.Cant = "鼠鬚管"; +im.rime.inputmethod.Squirrel.Cant = "鼠鬚筆"; CFBundleName = "鼠鬚管"; CFBundleDisplayName = "鼠鬚管"; From c91bc8e76a5f64c5880834503545817f23dda972 Mon Sep 17 00:00:00 2001 From: groverlynn Date: Tue, 3 Oct 2023 07:00:09 +0200 Subject: [PATCH 3/3] say ZH voices --- en.lproj/Localizable.strings | 5 +++++ main.m | 10 ++++------ zh-HK.lproj/Localizable.strings | 5 +++++ zh-Hans.lproj/Localizable.strings | 5 +++++ zh-Hant.lproj/Localizable.strings | 5 +++++ 5 files changed, 24 insertions(+), 6 deletions(-) diff --git a/en.lproj/Localizable.strings b/en.lproj/Localizable.strings index 02184186b..f18edf7fd 100644 --- a/en.lproj/Localizable.strings +++ b/en.lproj/Localizable.strings @@ -4,3 +4,8 @@ "deploy_start" = "Deploying Rime input method engine…"; "deploy_success" = "Squirrel is ready."; "deploy_failure" = "Error occurred. See log file $TMPDIR/rime.squirrel.INFO."; + +"problematic_launch" = "Problematic launch detected! \ + Squirrel may be suffering a crash due to imporper configuration. \ + Revert previous modifications to see if the problem recurs."; +"say_voice" = "Alex"; diff --git a/main.m b/main.m index 2a1a556f3..55a7703a2 100644 --- a/main.m +++ b/main.m @@ -78,12 +78,10 @@ int main(int argc, char *argv[]) { if (NSApp.squirrelAppDelegate.problematicLaunchDetected) { NSLog(@"Problematic launch detected!"); - NSArray *args = @[ - @"Problematic launch detected! \ - Squirrel may be suffering a crash due to imporper configuration. \ - Revert previous modifications to see if the problem recurs." - ]; - [NSTask launchedTaskWithLaunchPath:@"/usr/bin/say" arguments:args]; + NSArray *args = @[@"-v", NSLocalizedString(@"say_voice", nil), + NSLocalizedString(@"problematic_launch", nil)]; + [NSTask launchedTaskWithExecutableURL:[[NSURL alloc] initFileURLWithPath:@"/usr/bin/say"] + arguments:args error:nil terminationHandler:nil]; } else { [NSApp.squirrelAppDelegate setupRime]; [NSApp.squirrelAppDelegate startRimeWithFullCheck:NO]; diff --git a/zh-HK.lproj/Localizable.strings b/zh-HK.lproj/Localizable.strings index 7d9d8c7e2..89b943f52 100644 --- a/zh-HK.lproj/Localizable.strings +++ b/zh-HK.lproj/Localizable.strings @@ -11,3 +11,8 @@ "deploy_start" = "部署輸入法引擎⋯"; "deploy_success" = "部署完成。"; "deploy_failure" = "有錯誤!請查看日誌 $TMPDIR/rime.squirrel.INFO"; + +"problematic_launch" = "啟動時偵測到錯誤!\ + 「鼠鬚筆」可能由於設定不當而崩潰。\ + 請嘗試回退先前的改動,然後查看問題是否仍然存在。"; +"say_voice" = "Sinji"; diff --git a/zh-Hans.lproj/Localizable.strings b/zh-Hans.lproj/Localizable.strings index b1b90801a..26a54a014 100644 --- a/zh-Hans.lproj/Localizable.strings +++ b/zh-Hans.lproj/Localizable.strings @@ -11,3 +11,8 @@ "deploy_start" = "部署输入法引擎…"; "deploy_success" = "部署完成。"; "deploy_failure" = "有错误!请查看日志 $TMPDIR/rime.squirrel.INFO"; + +"problematic_launch" = "检测到启动有问题!\ + “鼠须管”可能因错误设置而崩溃。\ + 请尝试撤销之前的修改,然后查看问题是否仍旧存在。"; +"say_voice" = "TingTing"; diff --git a/zh-Hant.lproj/Localizable.strings b/zh-Hant.lproj/Localizable.strings index 80748bebf..b51f6b7ea 100644 --- a/zh-Hant.lproj/Localizable.strings +++ b/zh-Hant.lproj/Localizable.strings @@ -11,3 +11,8 @@ "deploy_start" = "部署輸入法引擎⋯"; "deploy_success" = "部署完成。"; "deploy_failure" = "有錯誤!請查看日誌 $TMPDIR/rime.squirrel.INFO"; + +"problematic_launch" = "啟動時偵測到問題!\ + 「鼠鬚管」可能因設定不當而崩潰。\ + 請嘗試回退先前的修改,然後查看問題是否依然存在。"; +"say_voice" = "MeiJia";