gasolin / lingascript Goto Github PK
View Code? Open in Web Editor NEWMultilingual Javascript (support non-English languages), based on Typescript
License: Apache License 2.0
Multilingual Javascript (support non-English languages), based on Typescript
License: Apache License 2.0
host slide through mdx-deck
To improve the readability and the maintenance effort, Move npm scripts to standalone scripts/
folder Instead of run commands in package.json
refer https://code.visualstudio.com/docs/languages/typescript
and https://github.com/Microsoft/TypeScript/wiki/Debugging-Language-Service-in-VS-Code
To make LingaScript as a drop replacement of typescript, may need patch typescript/src/services
to get autocomplete work in vscode
Followed steps here, and ./node_modules/bin/tsc
doesn't work for me. I change it to ./node_modules/lingascript-cn/bin/tsc
to successfully run npm run compile
. I wonder if this change is indeed necessary or I missed something during the setup? I'll create a draft PR including this.
feedback from the thread https://www.facebook.com/groups/f2e.tw/permalink/2022526214451400/
Anyone agree with this change?
2-way conversion is useful to make sure the conversion is right
this might not possible since transpile ts(en) to js will lose some context
in #7 @nobodxbodon suggest make a comparison with babylscript
run tsc with --locale zh-tw
option can bring the localized compile error message
ex: tsc --locale zh-tw -p examples/tw
will be nice if we can set related locale by default in build time
Change 'while' keyword from 每當
to 直到
in cn/tw
while (傳說 = true) {
}
每當(傳說 = 真的) {
}
->
直到(傳說 = 真的) {
}
current patch use XXX == 'keyword' || XXX == 'trans_keyword'
inline to support different languages
could be replaced by a set of isKeyword[Keyword] function and wrap the matching detail inside of the function
ex, instead of XXX == 'Symbol' || XXX == '中文'
replace to isKeyword(XXX)
and define function
function isKeywordSymbol(value) {
return value == 'Symbol' || value == '中文'
}
The change could be proposed to TypeScript for maintainability.
By replacing the isKeyword[Keyword] functions, LingaScript could even support parse multi-native-language keywords in the same compiler
Try to compile https://github.com/program-in-chinese/vscode_english_chinese_dictionary with lingascript.
Note currently lingascript does not provide the pre-build version yet. You need build first and run with command like
node typescript/built/local/tsc.js -p vscode_english_chinese_dictionary
@testacount1 @nobodxbodon are you interest in this?
and add instruction in README
or doc/
feedback from the thread https://www.facebook.com/groups/f2e.tw/permalink/2022526214451400/
Anyone agree with this change?
Similar to this tutorial written for CTS. It can be a first 'real-world' test case.
I'll start the document in a separate repo for now.
Related Package (please complete the following information):
https://github.com/Microsoft/TypeScript/releases/tag/v3.3.3333
Is your feature request related to a problem? Please describe.
New TS v3.3.3333 is released (b145eaf
), try to catch up the version and validate if current patch method works
follow https://github.com/gasolin/lingascript/blob/master/examples/cn/src/basic.ts
to improve
https://github.com/gasolin/lingascript/blob/master/examples/tw/src/basic.ts
Accept critiria:
npm run test:tw
command to make sure all test pass["a", "b", "c"].length can be written as ["a", "b", "c"].长度
Should work In Example:
EN:
let strLength2: number = (someValue2 as string).length;
CN:
变量 strLength2: 数字 = (someValue2 转为 文字).长度;
Related Package (please complete the following information):
Is your feature request related to a problem? Please describe.
need separate subfix to support syntax highlight correctly, or the editor will show errors
Describe the solution you'd like
support twjs / cnjs subfix
Additional context
Some user experice sharing in #19
繁中版本已發布到npm
https://www.npmjs.com/package/lingascript-tw
需熟簡體中文的朋友協助翻譯 README 文檔後,再釋出 lingascript-cn
https://github.com/gasolin/lingascript/blob/master/src/cn/README.md
makecode seems a good candidate to build the online/offline playground
https://makecode.com/language
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.