opencc-js
opencc-js copied to clipboard
The JavaScript version of Open Chinese Convert (OpenCC)
你好,请问能否将 `OpenCCJSData` 变量改为用 `window` 或 `globalThis` 来声明? 目前使用的声明方式 `const OpenCCJSData` 在动态加载时不能使用 `window.OpenCCJSData` 进行访问。
``` webpack-internal:///./node_modules/opencc-js/bundle-node.js:97 const n = s.length, arr = []; ^ TypeError: Cannot read properties of undefined (reading 'length') at Trie.convert (webpack-internal:///./node_modules/opencc-js/bundle-node.js:97:19) at convert (webpack-internal:///./node_modules/opencc-js/bundle-node.js:170:48) at pushRssToChannel (webpack-internal:///./src/news/pushRssToChannel.ts:31:39) at eval (webpack-internal:///./src/bot/botStart.ts:51:52)...
The `.HTMLConverter` API works perfectly for text nodes, but it would be even nicer if it could also convert attributes like `placeholder`, `aria-label` etc. Thanks.
es6 imports
Sorry if this is obvious (JS is still somewhat opaque to me...), but how would one use this with es6 imports? I tried various versions of what is described [here](https://stackoverflow.com/questions/41179828/es6-import-equivalent-of-require-without-exports)...
- [x] Gather definitions of terms within an API section - [x] Initiate definitions, default, syntax presentations. - [ ] Review recent changes [README.md](https://github.com/nk2028/opencc-js/blob/main/README.md) - [ ] Continue improvements of...
Hello.If I have been translated from SIMPLIFIED to TRADITIONAL, then my new input content will not be traditional. Is there any way to solve this problem?
松原市乾安县远辉新能源发展有限公司 转化成了 松原市干安县远辉新能源发展有限公司 const converter = OpenCC.Converter({ from: 'hk', to: 'cn' }); const result = converter('松原市乾安县远辉新能源发展有限公司'); console.log(result); // 结果为: 松原市干安县远辉新能源发展有限公司 见图: 