Treat U+30A0 & U+30FB in Katakana Block as CJK (#16796)

This commit is contained in:
Tatsunori Uchino authored and GitHub committed 2024-11-26 23:52:53 +08:00
1 parent d52e905869
commit ac46a4f16e
5 files changed
+56 -1

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
#### Treat U+30A0 & U+30FB in Katakana Block as CJK (#16796 by @tats-u)
Prettier doesn't treat U+30A0 & U+30FB as Japanese. U+30FB is commonly used in Japanese to represent the delimitation of first and last names of non-Japanese people or “and”. The following “C言語・C++・Go・Rust” means “C language & C++ & Go & Rust” in Japanese.
<!-- prettier-ignore -->
```md
<!-- Input (--prose-wrap=never) -->
C言
語
・
C++
・
Go
・
Rust
<!-- Prettier stable -->
C言語・ C++ ・ Go ・ Rust
<!-- Prettier main -->
C言語・C++・Go・Rust
```
U+30A0 can be used as the replacement of the `-` in non-Japanese names (e.g. “Saint-Saëns” (Charles Camille Saint-Saëns) can be represented as “サン゠サーンス” in Japanese), but substituted by ASCII hyphen (U+002D) or U+FF1D (full width hyphen) in many cases (e.g. “サン=サーンス” or “サン=サーンス”).
+1
View File
@@ -241,6 +241,7 @@
"Rubocop", "Rubocop",
"ruleset", "ruleset",
"rulesets", "rulesets",
"Saëns",
"sandhose", "sandhose",
"Sapegin", "Sapegin",
"sbdchd", "sbdchd",
+8 -1
View File
@@ -14,7 +14,14 @@ const cjkCharset = new Charset(
"Modifier_Symbol", "Modifier_Symbol",
"Nonspacing_Mark", "Nonspacing_Mark",
], ],
}), // .union below makes the next Block condition "OR"
// If it is merged into this object definition, it will be "AND" instead
}).union(
// Firefox treats some symbols (U+30A0, U+30FB) in the Katakana block as CJK
unicodeRegex({
Block: ["Katakana"],
}),
),
); );
const variationSelectorsCharset = unicodeRegex({ const variationSelectorsCharset = unicodeRegex({
Block: ["Variation_Selectors", "Variation_Selectors_Supplement"], Block: ["Variation_Selectors", "Variation_Selectors_Supplement"],
@@ -283,6 +283,16 @@ English
[ウ [ウ
ィキペディア]: https://ja.wikipedia.org/ ィキペディア]: https://ja.wikipedia.org/
C言
語
・
C++
・
Go
・
Rust
=====================================output===================================== =====================================output=====================================
日本語、にほんご。汉语, 中文. 日本語,にほんご.English 日本語、にほんご。汉语, 中文. 日本語,にほんご.English
words!? 漢字!汉字?「セリフ」(括弧) 文字(括弧)文字【括弧】日本語English words!? 漢字!汉字?「セリフ」(括弧) 文字(括弧)文字【括弧】日本語English
@@ -297,5 +307,7 @@ words!? 漢字!汉字?「セリフ」(括弧) 文字(括弧)文字【括
[ウ ィキペディア]: https://ja.wikipedia.org/ [ウ ィキペディア]: https://ja.wikipedia.org/
C言語・C++・Go・Rust
================================================================================ ================================================================================
`; `;
@@ -57,3 +57,13 @@ English
[ウ [ウ
ィキペディア]: https://ja.wikipedia.org/ ィキペディア]: https://ja.wikipedia.org/
C言
語
・
C++
・
Go
・
Rust