EsperSkripto

raw JSON →
0.0.2 verified Fri May 01 auth: no javascript

A multilingual transpiler for JavaScript that allows writing code in Simplified Chinese (Mandarin) and Esperanto. v0.0.2 is the latest release as of early 2024, with sporadic maintenance. It transpiles Chinese or Esperanto keywords and built-in function names (e.g., 控制台.记录 -> console.log) to standard JavaScript. Unlike usual i18n tools, it directly renames keywords and identifiers, not just UI strings. Still experimental, with limited language support and no advanced features like module translation or type checking.

error Error: Cannot find module 'esperskripto'
cause CLI not installed globally or npx not used.
fix
npm install -g esperskripto or use npx esperskripto
error SyntaxError: Unexpected token
cause Input file contains unrecognized keyword or invalid syntax for the transpiler.
fix
Ensure all keywords are from the supported language set (e.g., 函数, 对于, 控制台.记录 or funkcio, por, konzolo.protokolu). Check for typos.
error Error: Unknown language 'fr'
cause Specified language code not supported.
fix
Use one of: eo (Esperanto) or zh-cmn-Hans (Simplified Chinese).
gotcha The transpiler only handles built-in keywords and globals (like console, function, for, let). Custom identifiers and strings are left untranslated.
fix Use only predefined keyword translations. Do not attempt to translate variable or function names automatically.
gotcha The file extension is not automatically detected; you must provide the correct language option via -l flag for Chinese, or Esperanto is default? Actually, Esperanto is default if no -l given.
fix Always explicitly specify -l eo or -l zh-cmn-Hans to avoid ambiguity.
breaking v0.0.2 may have breaking changes from v0.0.1; version range unspecific.
fix Test translation output before relying on it.
gotcha The CLI transpiles a file in-place? No, it outputs to stdout. Overwrite must be done manually.
fix Redirect output: esperskripto file.js > output.js
npm install esperskripto
yarn add esperskripto
pnpm add esperskripto

Transpiles a JavaScript file written in Esperanto or Chinese keywords to standard JavaScript using the CLI.

// Create a file 'test.eo' with Esperanto JavaScript:
// funkcio provuIomete(){
//   por(jen i=0;i<5;++i){
//     konzolo.protokolu(i);
//   }
// }
// provuIomete();

// Then run:
// npx esperskripto test.eo

// Or for Chinese:
// Create 'test.zh.js' with:
// 函数 试一试(){
//   对于(让 甲=0;甲<5;++甲) {
//     控制台.记录(甲);
//   }
// }
// 试一试();
// Run: npx esperskripto -l zh-cmn-Hans test.zh.js