Installation
LokaScript adds multilingual support to
hyperfixi. Choose the package
that matches your use case.
For Code Translation & Semantic Parsing
Translation and parsing are the same package: translating means parsing the
source into a semantic node and rendering that node in the target language.
npm install @hyperfixi/core @lokascript/semantic
import { translate, getSupportedLanguages } from '@lokascript/semantic';
// Translate code between languages
const japanese = translate('toggle .active', 'en', 'ja');
// → '.active を 切り替え'
// Get all supported languages
const langs = getSupportedLanguages();
// ['en', 'ja', 'ko', 'zh', 'ar', 'tr', 'es', 'de', 'fr', 'pt', ...]
Parse to a node directly when you want the structure rather than a surface
string — it carries a confidence score, and buildAST turns it into
something the runtime can execute:
import { parse, buildAST } from '@lokascript/semantic';
const node = parse('on click toggle .active on me', 'en');
console.log(node.metadata.confidence); // 1
const { ast, warnings } = buildAST(node);
For Language Vocabulary
@lokascript/i18n carries the per-language keyword dictionaries, locale
detection, and grammar profiles. Install it when you need those directly —
it does not translate (that moved to @lokascript/semantic).
npm install @lokascript/i18n
import { getProfile, getSupportedLocales } from '@lokascript/i18n';
getProfile('ja').wordOrder; // 'SOV'
For Existing _hyperscript Projects
Add multilingual support to projects already using the original
_hyperscript — no migration required:
<script src="https://unpkg.com/hyperscript.org"></script>
<script src="https://unpkg.com/@lokascript/hyperscript-adapter@2.10.0/dist/hyperscript-i18n-es.global.js"></script>
<button _="on click alternar .active" data-lang="es">
Haz clic
</button>
See the adapter plugin guide for bundle
options and live demos.
Installing hyperfixi (Core Runtime)
LokaScript packages require the hyperfixi runtime. If you haven't
installed it yet, see the
hyperfixi installation guide.
Next Steps
- Multilingual API - Full API reference for translation and parsing
- Patterns - Browse 166 patterns in 24 languages
- Adapter Plugin - Add multilingual support to _hyperscript