lingascript-tw
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

LingaScript-tw

LingaScript-tw 是支援正體(繁體)中文關鍵字的 TypeScript 編譯器。語法衍生自 Typescript (和 Javascript)。

LingaScript-tw 可以將以正體中文撰寫的腳本編譯成 Javascript,可在任意支援Javascript的環境中執行。

歡迎探索非英語程式語言 的朋友一同參與,我們可以透過改進共用的核心,來提供更好用的非英語程式語言工具。具體請查看LingaScript專案網站

Non-english programming adventurers can easily add your local language, work together to improve the same core, and get benifit for the shared programming tools with better local language support. Check out the LingaScript repo.

支援的本地語言

LingaScript-tw 支援正體中文與英文關鍵字(Keywords),要支援別的語言需分別安裝不同套件。

使用說明

可使用npm命令安裝 LingaScript:

npm install -g lingascript-tw

安裝後可得到tsc命令. (和TypeScript相同)

建立測試.ts檔案如下

變數 一切都是 = 假的;

或加上 TypeScript 宣告

變數 一切都是:真假 = 假的;

然後使用以下命令編譯

tsc 測試.ts

則會輸出測試.js

var 一切都是 = false;

LingaScript 支援所有 TypeScript 編譯器的命令,所以也可以用如下指令

tsc examples/tw/src/測試.ts --outFile test.js

測試.ts輸出成test.js

要顯示中文的錯誤訊息,可以在執行tsc命令時加上--locale zh-tw參數, 如:

tsc --locale zh-tw test.ts

更多範例可參考 https://github.com/gasolin/lingascript/tree/master/examples/tw .

安裝到專案中 (而非安裝到全域)

先建立專案資料夾,並安裝 lingascript-tw

$ mkdir demo && cd demo && npm init
$ npm install lingascript-tw

編輯package.json加入以下設定

scripts: {
  "compile": "./node_modules/lingascript-tw/bin/tsc 測試.ts"
},
"devDependencies"{
  "lingascript-tw": "^0.2.0",
},

即可在專案中使用中文關鍵字開發程式,使用npm run compile命令進行編譯。

版本歷程

查看 https://github.com/gasolin/lingascript/blob/master/CHANGELOG.md

授權

Apache-2.0 License

Package Sidebar

Install

npm i lingascript-tw

Weekly Downloads

0

Version

0.3.0

License

Apache-2.0

Unpacked Size

43.1 MB

Total Files

78

Last publish

Collaborators

  • gasolin