新增歌词简体中文转繁体中文,当软件语言被设置为繁体中文后,播放歌曲的歌词也将自动转成繁体中文显示
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
todo.md
|
||||
node_modules/
|
||||
npm-debug.log
|
||||
yarn-debug.log
|
||||
yarn-error.log
|
||||
package-lock.json
|
||||
tsconfig.tsbuildinfo
|
||||
report.*.json
|
||||
|
||||
.eslintcache
|
||||
.DS_Store
|
||||
.idea
|
||||
.vscode
|
||||
.yarn
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2021 Shigma
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,10 @@
|
||||
# simplify-chinese
|
||||
|
||||
Convert chinese characters between simplified form and tranditional form / 汉字简繁体转换工具。
|
||||
|
||||
```js
|
||||
const { simplify, tranditionalize } = require('simplify-chinese')
|
||||
|
||||
console.log(simplify('窩窩頭')) // 窝窝头
|
||||
console.log(tranditionalize('窝窝头')) // 窩窩頭
|
||||
```
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,2 @@
|
||||
export function simplify(source: string): string
|
||||
export function tranditionalize(source: string): string
|
||||
@@ -0,0 +1,30 @@
|
||||
const { simplified, traditional } = require('./chinese')
|
||||
|
||||
const stMap = new Map()
|
||||
const tsMap = new Map()
|
||||
|
||||
simplified.split('').forEach((char, index) => {
|
||||
stMap.set(char, traditional[index])
|
||||
tsMap.set(traditional[index], char)
|
||||
})
|
||||
|
||||
function simplify(source) {
|
||||
let result = []
|
||||
for (const char of source) {
|
||||
result.push(tsMap.get(char) || char)
|
||||
}
|
||||
return result.join('')
|
||||
}
|
||||
|
||||
function tranditionalize(source) {
|
||||
let result = []
|
||||
for (const char of source) {
|
||||
result.push(stMap.get(char) || char)
|
||||
}
|
||||
return result.join('')
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
simplify,
|
||||
tranditionalize,
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "simplify-chinese",
|
||||
"description": "Convert chinese characters between simplified form and tranditional form 汉字简繁体转换工具",
|
||||
"version": "1.1.0",
|
||||
"main": "index.js",
|
||||
"typings": "index.d.ts",
|
||||
"repository": "https://github.com/koishijs/simplify-chinese.git",
|
||||
"author": "Shigma <1700011071@pku.edu.cn>",
|
||||
"license": "MIT"
|
||||
}
|
||||
Reference in New Issue
Block a user