From 6859d4bf8f2f139aa8d4be50bf023e173fd0a610 Mon Sep 17 00:00:00 2001 From: 1024jp <1024jp@wolfrosch.com> Date: Tue, 15 Aug 2023 23:05:07 +0900 Subject: [PATCH] Introduce depreated badge to character inspector --- .../en.lproj/pgs/howto_inspect_character.html | 2 +- .../ja.lproj/pgs/howto_inspect_character.html | 2 +- .../Sources/CharacterInspectorView.swift | 22 ++++++++++++++++--- CotEditor/de.lproj/Localizable.strings | 1 + CotEditor/en-GB.lproj/Localizable.strings | 1 + CotEditor/es.lproj/Localizable.strings | 1 + CotEditor/fr.lproj/Localizable.strings | 1 + CotEditor/it.lproj/Localizable.strings | 1 + CotEditor/ja.lproj/Localizable.strings | 1 + CotEditor/pt.lproj/Localizable.strings | 1 + CotEditor/tr.lproj/Localizable.strings | 1 + CotEditor/zh-Hans.lproj/Localizable.strings | 1 + CotEditor/zh-Hant.lproj/Localizable.strings | 1 + 13 files changed, 31 insertions(+), 5 deletions(-) diff --git a/CotEditor/CotEditor.help/Contents/Resources/en.lproj/pgs/howto_inspect_character.html b/CotEditor/CotEditor.help/Contents/Resources/en.lproj/pgs/howto_inspect_character.html index bcb81af5fa..f3dec2b551 100644 --- a/CotEditor/CotEditor.help/Contents/Resources/en.lproj/pgs/howto_inspect_character.html +++ b/CotEditor/CotEditor.help/Contents/Resources/en.lproj/pgs/howto_inspect_character.html @@ -19,7 +19,7 @@

Get information about a character in CotEditor

The character inspector indicating the information about the character 🐕 -

In the inspector, the character in close-up, the Unicode character name, block name, general category, and the Unicode code point will be displayed. It shows also UTF-16 codes of each character in braces if the character is a surrogate pair. If the selected letter consists actually of multiple Unicode characters, only the code points and Unicode name will be listed-up.

+

The inspector displays: the character in close-up, the Unicode code point, the Unicode character name, block name, general category, and the Unicode version that introduced the character. It shows also UTF-16 codes of each character in braces if the character is a surrogate pair. If the selected letter consists actually of multiple Unicode characters, only the code points and Unicode name will be listed-up.

diff --git a/CotEditor/CotEditor.help/Contents/Resources/ja.lproj/pgs/howto_inspect_character.html b/CotEditor/CotEditor.help/Contents/Resources/ja.lproj/pgs/howto_inspect_character.html index acb7c5b90f..d5f337dc69 100644 --- a/CotEditor/CotEditor.help/Contents/Resources/ja.lproj/pgs/howto_inspect_character.html +++ b/CotEditor/CotEditor.help/Contents/Resources/ja.lproj/pgs/howto_inspect_character.html @@ -19,7 +19,7 @@

CotEditorで文字情報を表示する

🐕の文字の情報を表示する文字インスペクタ -

表示には、拡大表示された文字、Unicode文字名、Unicodeブロック名、Unicodeカテゴリ名、Unicodeコードポイントが表示されます。選択された文字がサロゲートペアの場合には、括弧内に分割されたコードポイントも表示します。選択された文字が実際には複数のUnicode文字から成り立っていた場合は内包するコードポイントと文字名のみがリストアップされます。

+

インスペクタには、拡大表示された文字、Unicodeコードポイント、Unicode文字名、Unicodeブロック名、Unicodeカテゴリ名、その文字が導入されたUnicodeバージョンが表示されます。選択された文字がサロゲートペアの場合には、括弧内に分割されたコードポイントも表示します。選択された文字が実際には複数のUnicode文字から成り立っていた場合は内包するコードポイントと文字名のみがリストアップされます。

diff --git a/CotEditor/Sources/CharacterInspectorView.swift b/CotEditor/Sources/CharacterInspectorView.swift index 57563eb958..5b58955d00 100644 --- a/CotEditor/Sources/CharacterInspectorView.swift +++ b/CotEditor/Sources/CharacterInspectorView.swift @@ -126,12 +126,16 @@ private struct ScalarDetailView: View { Text("Code Point:") .gridColumnAlignment(.trailing) - Group { + HStack { if let surrogates = self.scalar.surrogateCodePoints { Text(verbatim: "\(self.scalar.codePoint) (\(surrogates.lead) \(surrogates.trail))") } else { Text(self.scalar.codePoint) } + if self.scalar.properties.isDeprecated { + Spacer() + DeprecatedBadge() + } } .monospacedDigit() .foregroundColor(.label) @@ -213,6 +217,18 @@ private struct CharacterView: NSViewRepresentable { } +private struct DeprecatedBadge: View { + + var body: some View { + + Text("deprecated") + .padding(.horizontal, 3) + .overlay(RoundedRectangle(cornerRadius: 3).stroke(.secondary)) + .foregroundColor(.secondary) + } +} + + // MARK: - Preview @@ -236,6 +252,6 @@ private struct CharacterView: NSViewRepresentable { CharacterInspectorView(info: CharacterInfo(character: "🇦🇦")) } - #Preview("deprecated") { - CharacterInspectorView(info: CharacterInfo(character: "ឣ")) +#Preview("deprecated") { + CharacterInspectorView(info: CharacterInfo(character: "ឣ")) } diff --git a/CotEditor/de.lproj/Localizable.strings b/CotEditor/de.lproj/Localizable.strings index c84c7e6146..70057a98ef 100644 --- a/CotEditor/de.lproj/Localizable.strings +++ b/CotEditor/de.lproj/Localizable.strings @@ -902,6 +902,7 @@ "Block:" = "Block:"; "Category:" = "Kategorie:"; "Version:" = "Version:"; +"deprecated" = "abgelehnt"; diff --git a/CotEditor/en-GB.lproj/Localizable.strings b/CotEditor/en-GB.lproj/Localizable.strings index 87cf09709d..fc1065977a 100644 --- a/CotEditor/en-GB.lproj/Localizable.strings +++ b/CotEditor/en-GB.lproj/Localizable.strings @@ -902,6 +902,7 @@ "Block:" = "Block:"; "Category:" = "Category:"; "Version:" = "Version:"; +"deprecated" = "deprecated"; diff --git a/CotEditor/es.lproj/Localizable.strings b/CotEditor/es.lproj/Localizable.strings index 214d691f9c..356a5f4db1 100644 --- a/CotEditor/es.lproj/Localizable.strings +++ b/CotEditor/es.lproj/Localizable.strings @@ -902,6 +902,7 @@ "Block:" = "Block:"; // FIXME: new "Category:" = "Category:"; // FIXME: new "Version:" = "Version:"; // FIXME: new +"deprecated" = "deprecated"; // FIXME: new diff --git a/CotEditor/fr.lproj/Localizable.strings b/CotEditor/fr.lproj/Localizable.strings index f863a701dd..dff77c6839 100755 --- a/CotEditor/fr.lproj/Localizable.strings +++ b/CotEditor/fr.lproj/Localizable.strings @@ -902,6 +902,7 @@ "Block:" = "Block:"; // FIXME: new "Category:" = "Category:"; // FIXME: new "Version:" = "Version:"; // FIXME: new +"deprecated" = "deprecated"; // FIXME: new diff --git a/CotEditor/it.lproj/Localizable.strings b/CotEditor/it.lproj/Localizable.strings index f0439fdbc5..45308c3c9c 100644 --- a/CotEditor/it.lproj/Localizable.strings +++ b/CotEditor/it.lproj/Localizable.strings @@ -902,6 +902,7 @@ "Block:" = "Block:"; // FIXME: new "Category:" = "Category:"; // FIXME: new "Version:" = "Version:"; // FIXME: new +"deprecated" = "deprecated"; // FIXME: new diff --git a/CotEditor/ja.lproj/Localizable.strings b/CotEditor/ja.lproj/Localizable.strings index 2c88b30a0a..b6c95b5bae 100644 --- a/CotEditor/ja.lproj/Localizable.strings +++ b/CotEditor/ja.lproj/Localizable.strings @@ -902,6 +902,7 @@ "Block:" = "ブロック:"; "Category:" = "カテゴリ:"; "Version:" = "バージョン:"; +"deprecated" = "非推奨"; diff --git a/CotEditor/pt.lproj/Localizable.strings b/CotEditor/pt.lproj/Localizable.strings index 78e90a4ce2..ca733c6b08 100644 --- a/CotEditor/pt.lproj/Localizable.strings +++ b/CotEditor/pt.lproj/Localizable.strings @@ -902,6 +902,7 @@ "Block:" = "Block:"; // FIXME: new "Category:" = "Category:"; // FIXME: new "Version:" = "Version:"; // FIXME: new +"deprecated" = "deprecated"; // FIXME: new diff --git a/CotEditor/tr.lproj/Localizable.strings b/CotEditor/tr.lproj/Localizable.strings index b0203ca678..c5578f508c 100644 --- a/CotEditor/tr.lproj/Localizable.strings +++ b/CotEditor/tr.lproj/Localizable.strings @@ -902,6 +902,7 @@ "Block:" = "Block:"; // FIXME: new "Category:" = "Category:"; // FIXME: new "Version:" = "Version:"; // FIXME: new +"deprecated" = "deprecated"; // FIXME: new diff --git a/CotEditor/zh-Hans.lproj/Localizable.strings b/CotEditor/zh-Hans.lproj/Localizable.strings index 61722dc587..f3428c6b66 100644 --- a/CotEditor/zh-Hans.lproj/Localizable.strings +++ b/CotEditor/zh-Hans.lproj/Localizable.strings @@ -902,6 +902,7 @@ "Block:" = "Block:"; // FIXME: new "Category:" = "Category:"; // FIXME: new "Version:" = "Version:"; // FIXME: new +"deprecated" = "deprecated"; // FIXME: new diff --git a/CotEditor/zh-Hant.lproj/Localizable.strings b/CotEditor/zh-Hant.lproj/Localizable.strings index dac7cf9f43..c8548f61d9 100644 --- a/CotEditor/zh-Hant.lproj/Localizable.strings +++ b/CotEditor/zh-Hant.lproj/Localizable.strings @@ -902,6 +902,7 @@ "Block:" = "Block:"; // FIXME: new "Category:" = "Category:"; // FIXME: new "Version:" = "Version:"; // FIXME: new +"deprecated" = "deprecated"; // FIXME: new