loka-js — the fixi family in your language

Write fixi-family attributes in your own language — fx-actionfx-acción / fx-アクション, live, on-click, fx-ignore and friends — across 24 locales, resolved at processing time.

loka-js is a community distribution for developers whose first language isn't English — not a replacement for the canonical libraries. If you read English comfortably, use fixi / moxi / paxi / ssexi / rexi directly: they're smaller, and that's their documentation. This page describes the localized distribution.

How it works

Names resolve at processing time through small per-library hooks — no preprocessor, no DOM mutation, and the attribute you wrote is the attribute devtools shows.

<!DOCTYPE html>
<html lang="es">
<head>
  <script src="./loka.js"></script>       <!-- defines window.loka, installs the localization hooks -->
  <script src="./locales/es.js"></script>  <!-- registers Spanish vocabulary -->
  <script src="./fixi.js"></script>        <!-- the fixi library, now localization-aware -->
</head>
<body>
  <button fx-acción="/api" fx-disparador="clic" fx-objetivo="#out">Cargar</button>
  <div id="out"></div>
</body>
</html>

Three things to notice:

  • The author writes fx-acción.
  • Devtools shows fx-acciónthe attribute is never rewritten.
  • fixi handles the click and swaps #out correctly.

Install

Pick your locale; the snippets below update in place. One tag installs the libraries plus the chosen locale via jsDelivr's /combine/ feature, which preserves load order automatically.

Snippets below update on change.

All five libraries:

Minimal (fixi only). Drop the libraries you don't need from the URL; keep loka.js first, the locale second, and fixi.js last:

Load order matters: loka.js must define window.loka.register before the locale registers vocabulary, and each library reads the registry at script-load time via ??= defaults. URL order in /combine/ preserves source order in the concatenated response, so the constraint is satisfied for you — but if you load the files individually, keep loka.js first and fixi.js last (with moxi.js before fixi.js, per fixiproject convention).

With no locale module loaded, every patched library is behaviorally identical to upstream — verified by a behavior-preservation harness.

24 locales

English is canonical fixi and needs no vocabulary module; the other 23 each ship one.

ar Arabic
bn Bengali
zh Chinese
fr French
de German
he Hebrew
hi Hindi
id Indonesian
it Italian
ja Japanese
ko Korean
ms Malay
pl Polish
pt Portuguese
qu Quechua
ru Russian
es Spanish
sw Swahili
tl Tagalog
th Thai
tr Turkish
uk Ukrainian
vi Vietnamese

Attribute names are a judgment call in every language, and corrections from
speakers are the most useful contribution here — open an
issue
or send a PR against
scripts/fx-vocab.mjs.

Live demo — per-element language

This page declares <html lang="en">, but each section below sets its own lang. Every section's fixi attributes resolve against its own language — Spanish in the Spanish section, Japanese in the Japanese section, English at the top level. Click the buttons; each loads a fragment through its localized fx-* attributes.

What makes it loka

Attributes are never rewritten

fx-acción, al-clic, fx-intercambio="morfar" stay verbatim in the DOM. Devtools shows exactly what you authored — the libraries resolve the canonical name through hooks at read time, not by mutating your markup.

Per-element language

Language is resolved via the nearest lang ancestor, so one page can mix <section lang="es"> and <section lang="ja"> and each resolves its own vocabulary. A preprocessor would have to commit to one language up front.

Inert by default

loka ships lightly-patched copies (~30–150 bytes each) that are bit-identical to upstream when no locale is loaded. The patches do nothing until a locale registers, so they re-port cleanly against upstream changes.

Shared vocabulary with LokaScript

loka-js and LokaScript draw their event and action words from the same @lokascript/semantic vocabulary source. A "click" is clic in both worlds, so a Spanish-speaking developer moving between rich hyperscript-style behaviors and minimal fixi-family hypermedia doesn't relearn DOM-event names.

LokaScript

The multilingual layer for hyperscript — write rich behaviors like al hacer clic alternar .active en mi in 24 languages. Reach for it when you're writing client-side behavior.

loka-js

The same idea applied to the fixi family — write minimal hypermedia attributes (fx-acción, fx-objetivo, …) in those same 24 languages. Reach for it when you're writing HTTP-attribute hypermedia. The two compose on one page without conflict.