Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

⚡ A super fast, small, and simple message localisation library

License

NotificationsYou must be signed in to change notification settings

eartharoid/i18n

Repository files navigation

A WIP super small and incredibly fast localisation librarywith no documentation.

Goals

  1. Speed
  2. Small size
  3. Simplicity, durability, and maintainability
  4. Optional type-safetyhttps://github.com/ivanhofer/typesafe-i18n
  5. Optional build step

Features

  • Simple JSON object input
  • Simple string/interpolation format
  • Pluralisation
  • In-code formatters
  • Bun for dev and TS testing

To-do

Notes

Crowdin

v3

current:

["ns:circular_2",{"t":"This is two, ","p":[[13,{"g":"$t",// v or g"d":{"k":"circular_1"}}]]}]

proposed:

["ns:circular_2",[{"t":"This is two, "// t, s, v, or g},{"g":"$t","d":{"k":"circular_1"}}]]

Placeholder positions aren't needed.

// raw=true - return segments instead of string[{text:'Hello'},{slot:['name','world']},// slots are omitted in non-raw (cooked..?) mode{text:'!'}]
// "Click {< here >} to {action} this {item}." // only works with 1 slot per string// "Click {$slot(link, here)} to {action} this {item}." // not good, it's a valid getter// "Click <{link} here> to {action} this {item}." // difficult"Click {<link>here} to {action} this {item}."// conflicts with "don't translate inside placeholders""Click <link% here %> to {action} this {item}.""Click {% link; here %} to {action} this {item}."

https://svelte.dev/docs/special-elements#slot

<I18nkey="example"variables={{action:'restart',item:'server' }}let:link><aslot="link"class="font-bold"on:click={restart()}>{link}</a></I18n>
variable:Hello {name}getter:I said "{$t(slot)}"# flatMapslot:Please click <slot1% here %>  or <slot2% here %>

[8]ページ先頭

©2009-2025 Movatter.jp