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.

referencessveltekit.md

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

SvelteKit

SvelteKit 3+ with Svelte 5. Components, the binding, the switcher, and rich text are the Svelte ones: svelte.md.

Packages

npm install yapyak @yapyak/vite @yapyak/svelte @yapyak/sveltekit

Build config

import { defineConfig } from 'vite';
import { sveltekit } from '@sveltejs/kit/vite';
import { yapyak } from '@yapyak/vite';

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

yapyak.config.ts

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

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

Use 'cookie' or 'url'; local storage flashes defaultLocale on every server render.

Types

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

Component

Write components as in svelte.md. locale.current reads the request-bound locale on the server once the handle below is registered.

Locale switcher

Write the client-side switcher as in svelte.md. Server-side, a remote form calls setLocale() inside the request:

import { redirect } from '@sveltejs/kit';
import { isLocale, setLocale } from 'yapyak';
import { form } from '$app/server';

export const localeForm = form('unchecked', async (data) => {
  const value = String(data.locale);
  if (isLocale(value)) {
    setLocale(value);
  }
  redirect(303, '/');
});

SSR

Export the handle:

export { handle } from '@yapyak/sveltekit';

Replace <html lang> and <html dir> in src/app.html with yapyak's placeholders:

<!doctype html>
<html lang="%yapyak.lang%" dir="%yapyak.dir%">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    %sveltekit.head%
  </head>
  <body>
    <div>%sveltekit.body%</div>
  </body>
</html>

Fixed-locale build

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

Quirks

  • With other handles in hooks.server.ts, compose them with SvelteKit's sequence() and keep yapyak's handle first, so every later handle reads the request-bound locale.
  • The handle wraps withResponse(event.request, () => resolve(event, ...)) and fills %yapyak.lang% and %yapyak.dir% during resolve.

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