Index of every page on this site: llms.txt
All skills
onmax avatar

/yapyak

@b4e1a3f official
by Maxonmax/nuxt-skills729 stars
38
Run it yourself

yapyak, an i18n compiler with a small runtime: t() with the source string as the key, ICU plurals and selects, rich text, format.* for numbers, dates and lists, locale switching and persistence, yapyak.config.ts, translators, the yapyak CLI, and YAPnnnn diagnostics. Use when adding or editing user-facing text in a project that depends on yapyak, when setting up @yapyak/vite, @yapyak/react, @yapyak/vue, @yapyak/svelte, @yapyak/astro, @yapyak/nuxt, @yapyak/react-router, @yapyak/sveltekit or @yapyak/tanstack-start, or when a YAP diagnostic fires.

Use this Skill: https://skilld.dev/gh/onmax/nuxt-skills/yapyak

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencessvelte.md

≈714 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Svelte

Svelte 5+ with Vite. SvelteKit adds an SSR adapter on top of this file: sveltekit.md.

Packages

npm install yapyak @yapyak/vite @yapyak/svelte

Build config

import { defineConfig } from 'vite';
import { svelte } from '@sveltejs/vite-plugin-svelte';
import { yapyak } from '@yapyak/vite';

export default defineConfig({
  plugins: [svelte(), yapyak()]
});

yapyak.config.ts

import { defineConfig } from 'yapyak/config';
import { svelte } from '@yapyak/svelte/processor';

export default defineConfig({
  processors: [svelte()],
  syncHtmlAttributes: true
});

Types

Add .yapyak/types.d.ts and yapyak.config.ts to include in tsconfig.json.

Where t() works

Any .ts or .js file, plus <script> blocks and markup expressions in .svelte files.

Component

<script lang="ts">
  import { t } from 'yapyak';
</script>

<button>{t('Save changes')}</button>

Subscribe to no store: a component that calls t() reads the locale $state rune and re-runs on a locale change.

Locale

<script lang="ts">
  import { locale } from '@yapyak/svelte';
  import { t } from 'yapyak';
</script>

<button onclick={() => (locale.current = locale.current === 'en' ? 'sv' : 'en')}>
  {t('Switch language')}
</button>

locale.current is the active locale. Reading it tracks; assigning switches.

Text direction

textDirection.current from @yapyak/svelte is 'ltr' or 'rtl'.

<p dir={textDirection.current}>{t('Save changes')}</p>

Locale switcher

<script lang="ts">
  import { locale } from '@yapyak/svelte';
  import { format, locales } from 'yapyak';
</script>

<select bind:value={locale.current}>
  {#each locales as value (value)}
    <option {value}>{format.in(value).displayName(value, 'language')}</option>
  {/each}
</select>

Rich text

<script lang="ts">
  import { RichText } from '@yapyak/svelte';
  import { t } from 'yapyak';
</script>

<p>
  <RichText value={t('Read our <link>privacy policy</link> for details.')}>
    {#snippet link(children)}
      <a href="/privacy">{@render children()}</a>
    {/snippet}
  </RichText>
</p>
<RichText value={t('Line one<br/>line two')}>
  {#snippet br()}<br />{/snippet}
</RichText>

A tag is a snippet prop. A pair-tag snippet receives a children snippet; render it with {@render children()}. A void-tag snippet takes no arguments. A missing snippet and a snippet for a tag the source lacks are both type errors.

Fixed-locale build

yapyak({ fixedLocale: process.env.YAPYAK_LOCALE })

Quirks

  • Svelte 5 runes only. locale is not a Svelte store; never write $locale.
  • Event attributes are the Svelte 5 form, onclick={...}, not on:click.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts10d3 checks · Risk SAFE
  • Gen Agent Trust Hub11d

    yapyak is an internationalization (i18n) toolchain for web applications that automates string extraction and translation using AI models. The primary security consideration is the potential for indirect prompt injection when translatable strings are sent to third-party AI providers for processing.

  • Socket10d

    No alerts

  • Snyk11d

    Risk: LOW · No issues

Signed by skilld at b4e1a3f. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 15 hours ago.

Activeupdated 2 weeks ago
metadata
{
  "source": "https://github.com/yapyak/yapyak/tree/main/skills/yapyak"
}

README badge

README badge for onmax/nuxt-skills/yapyak