mirror of
https://github.com/zh-lx/pinyin-pro.git
synced 2026-03-13 09:51:38 +08:00
Add support for traditional Chinese characters with the `traditional` option. This includes new `addTraditionalDict` and `getTraditionalDict` APIs, and integration with pinyin, html, and segment functions. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
14 lines
306 B
TypeScript
14 lines
306 B
TypeScript
const traditionalDict: string[] = [];
|
|
|
|
export function addTraditionalDict(dict: Record<string, string>) {
|
|
for (let key in dict) {
|
|
const value = dict[key];
|
|
const code = key.charCodeAt(0);
|
|
traditionalDict[code] = value;
|
|
}
|
|
}
|
|
|
|
export function getTraditionalDict() {
|
|
return traditionalDict;
|
|
}
|