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.

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.