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.

referencesreact-router.md

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

React Router

React Router 7.9+ in framework mode with SSR. Components, the binding, the switcher, and rich text are the React ones: react.md.

Packages

npm install yapyak @yapyak/vite @yapyak/react @yapyak/react-router

Build config

import { defineConfig } from 'vite';
import { reactRouter } from '@react-router/dev/vite';
import { yapyak } from '@yapyak/vite';

export default defineConfig({
  plugins: [reactRouter(), 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

Export the middleware from the root route and render <html lang> and <html dir> from the hooks:

import type { ReactNode } from 'react';
import type { Route } from './+types/root';
import { useLocale, useTextDirection } from '@yapyak/react';
import { middleware as yapyakMiddleware } from '@yapyak/react-router';
import { Links, Meta, Outlet, Scripts, ScrollRestoration } from 'react-router';

export const middleware: Route.MiddlewareFunction[] = [yapyakMiddleware];

export function Layout({ children }: { children: ReactNode }) {
  const [locale] = useLocale();
  const textDirection = useTextDirection();
  return (
    <html lang={locale} dir={textDirection}>
      <head>
        <Meta />
        <Links />
      </head>
      <body>
        {children}
        <ScrollRestoration />
        <Scripts />
      </body>
    </html>
  );
}

export default function App() {
  return <Outlet />;
}

react-router.config.ts has ssr: true. On React Router 7.9 through 7.x, middleware is opt-in: add future: { v8_middleware: true } there. On v8 it is on by default.

Fixed-locale build

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

Quirks

  • The middleware wraps withResponse(request, () => next()). A setLocale() call in a loader or action buffers a Set-Cookie that the middleware flushes onto the response.
  • A response rendered without the middleware, such as a URL that matches no route, reports YAP0022 and uses defaultLocale.

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