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.

referencestanstack-start.md

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

TanStack Start

TanStack Start 1.168+. Components, the binding, the switcher, and rich text are the React ones: react.md.

Packages

npm install yapyak @yapyak/vite @yapyak/react @yapyak/tanstack-start

Build config

import { defineConfig } from 'vite';
import { tanstackStart } from '@tanstack/react-start/plugin/vite';
import react from '@vitejs/plugin-react';
import { yapyak } from '@yapyak/vite';

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

yapyak.config.ts

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

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

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 react.md. useLocale() and useTextDirection() read the request-bound locale on the server once the middleware below is registered.

SSR

Register the middleware in the start entry:

import { createStart } from '@tanstack/react-start';
import { middleware } from '@yapyak/tanstack-start';

export const startInstance = createStart(() => ({
  requestMiddleware: [middleware]
}));

Render <html lang> and <html dir> in the root route's shell component:

import type { ReactNode } from 'react';
import { HeadContent, Scripts, createRootRoute } from '@tanstack/react-router';
import { useLocale, useTextDirection } from '@yapyak/react';

export const Route = createRootRoute({
  shellComponent: RootDocument
});

function RootDocument({ children }: { children: ReactNode }) {
  const [locale] = useLocale();
  const textDirection = useTextDirection();
  return (
    <html lang={locale} dir={textDirection}>
      <head>
        <HeadContent />
      </head>
      <body>
        {children}
        <Scripts />
      </body>
    </html>
  );
}

Fixed-locale build

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

Quirks

  • Keep middleware in requestMiddleware, alongside other request middleware such as createCsrfMiddleware(). The adapter extracts the Response from the middleware result to flush a buffered Set-Cookie.

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