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.

referencesvue.md

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

Vue

Vue 3.4+ with Vite. Nuxt wraps this file in a module: nuxt.md.

Packages

npm install yapyak @yapyak/vite @yapyak/vue

Build config

import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import { yapyak } from '@yapyak/vite';

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

yapyak.config.ts

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

export default defineConfig({
  processors: [vue()],
  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 <template> expressions in .vue files. Import t in <script setup>; the template sees it.

Component

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

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

Install no Vue plugin and provide nothing: a component that calls t() reads the locale customRef and re-renders on a locale change.

Locale

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

<template>
  <button @click="locale = locale === 'en' ? 'sv' : 'en'">
    {{ t('Switch language') }}
  </button>
</template>

locale is a Ref<Locale>. Read locale.value in script and locale in a template; assign to switch.

Text direction

textDirection from @yapyak/vue is a Readonly<Ref<TextDirection>>.

<p :dir="textDirection">{{ t('Save changes') }}</p>

Locale switcher

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

<template>
  <select v-model="locale">
    <option v-for="value in locales" :key="value" :value="value">
      {{ format.in(value).displayName(value, 'language') }}
    </option>
  </select>
</template>

Rich text

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

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

A tag is a named slot. A pair-tag slot receives { children }; render it with <component :is="children" />. A void-tag slot receives nothing.

Fixed-locale build

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

Quirks

  • A missing slot is not a compile error: the tag renders as literal text at runtime. Check every tag in the source has a <template #name>. A slot for a tag the source lacks is a type error.
  • Write t() in a template exactly as in script. The processor reads mustache and directive expressions, including :title="t('Settings')".

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