Przejdź do treści
Biblioteka skilli
Programowanie · Integracja z narzędziem

intlayer-preact

/intlayer-preact

Integruje internacjonalizację Intlayer z aplikacjami Preact, w tym tłumaczone komponenty, hook useIntlayer i konfigurację providerów.

Repozytorium
intlayer ↗
Licencja
Apache-2.0
Ostatnia zmiana repozytorium
27.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
11
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
4
Przestarzałość

Brak sygnałów. Repozytorium zmienione 27.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

Co robi i kiedy

Integruje internacjonalizację Intlayer z aplikacjami Preact, w tym tłumaczone komponenty, hook useIntlayer i konfigurację providerów.

Wyzwalacze z opisu

setup Preact i18nuseIntlayer
Oryginalny opis (EN)

Integrates Intlayer internationalization with Preact applications. Use when the user asks to "setup Preact i18n", create a new translated component, use the "useIntlayer" hook in Preact, or configure providers.

Jak działa

  1. Core Philosophy
  2. Workflow
  3. Setup
  4. useIntlayer Hook
  5. Bundle Optimization
  6. Compiler
  7. References
Sekcje z nagłówków SKILL.md, w oryginale · 93 linii, 289 słów
Podgląd SKILL.md
---
name: intlayer-preact
description: Integrates Intlayer internationalization with Preact applications. Use when the user asks to "setup Preact i18n", create a new translated component, use the "useIntlayer" hook in Preact, or configure providers.
metadata:
  author: Intlayer
  url: https://intlayer.org
  license: Apache-2.0
  mcp-server: "@intlayer/mcp"
  category: productivity
  tags: [i18n, preact, vite]
  documentation: https://intlayer.org/doc
  support: contact@intlayer.org
---

# Intlayer Preact Usage

## Core Philosophy

Intlayer promotes **Component-Level Content Declaration**. Instead of a massive global translation file, content is declared in `*.content.ts` files adjacent to the Preact components that use them.

## Workflow

To create a translated component, you need two files:

1.  **Declaration:** A content file (e.g., `myComponent.content.ts`) defining the dictionary.
2.  **Implementation:** A Preact component (e.g., `MyComponent.tsx`) using the `useIntlayer` hook.

### Declare Content

Create a content file using `t()` for translations.
**File:** `src/components/MyComponent/myComponent.content.ts`

```typescript
import { t, type Dictionary } from "intlayer";

const content = {
  // The 'key' must be unique and matches what you pass to useIntlayer()
  key: "my-component",
  content: {
    text: t({
      en: "Welcome",
      fr: "Bienvenue",
      es: "Hola",
    }),
  },
} satisfies Dictionary;

export default content;
```

## Setup

- [Vite and Preact](references/environment_vite-and-preact.md)

## useIntlayer Hook

```tsx
import { useIntlayer } from "preact-intlayer";

const MyComponent = () => {
  const content = useIntlayer("my-component");

  return (
    <div>
      <h1>
        {/* Return content */}
        {content.text}
      </h1>
      {/* Return string (.value) */}
      <img src={content.text.value} alt={content.text.value} />
    </div>
  );
};
```

## Bundle Optimization

Read content fields by name (dot access or destructuring) so the build can purge and minify the dictionary. Never index content at runtime (`content.statuses[status]`, use `select()`), and call `useIntlayer` in each child component instead of passing content as a prop. See the `intlayer-bundle-optimization` skill.

## Compiler

The [Intlayer Compiler](references/compiler.md) can extract all your content keys from your components, using one CLI command (`npx intlayer extract`) or automatically at app build.

## References

- [Website](https://intlayer.org)
- [Doc](https://intlayer.org/doc)

### Environments

- [Vite and Preact](references/environment_vite-and-preact.md)
- [Astro and Preact](references/environment_astro_preact.md)

### Concepts

- [Variants](references/concept_variants.md)
- [Collections](references/concept_collections.md)
- [Compiler](references/compiler.md)
- [Formatters (number, currency, date, …)](references/formatters.md)

### Packages

- [Intlayer Exports](references/packages_intlayer_exports.md)
- [Preact Intlayer Exports](references/packages_preact-intlayer_exports.md)
- [preact-intlayer usePathname](references/packages_preact-intlayer_usePathname.md)
Pliki w paczce (11)
  • LICENCE.md 11 KB
  • SKILL.md 3 KB
  • references/compiler.md 15 KB
  • references/concept_collections.md 6 KB
  • references/concept_variants.md 21 KB
  • references/environment_astro_preact.md 38 KB
  • references/environment_vite-and-preact.md 53 KB
  • references/formatters.md 17 KB
  • references/packages_intlayer_exports.md 12 KB
  • references/packages_preact-intlayer_exports.md 3 KB
  • references/packages_preact-intlayer_usePathname.md 3 KB

Wersje

W bazie nie ma innych skilli o nazwie intlayer-preact.

Identyczna treść występuje jeszcze w 1 innych folderach na GitHubie. Tu pokazujemy jedną, najlepiej ocenioną kopię.

Migawka bazy z 28.10.2026 · wersja paczki 1dc56295cd7e (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100intlayer-react
    Integruje internacjonalizację Intlayer z aplikacjami React, w tym tłumaczone komponenty, hook useIntlayer i konfigurację providerów.
  • 100intlayer-svelte
    Integruje internacjonalizację Intlayer z aplikacjami Svelte i SvelteKit, w tym tłumaczone komponenty, store useIntlayer i konfigurację providerów.
  • 100preact
    Pilnuje, by aplikacja Preact działała jako zamiennik Reacta: sygnały do stanu, warstwa compat i lekkie paczki.
  • 100preact
    Pomaga budować aplikacje w Preact, 3-kilobajtowej alternatywie dla Reacta z tym samym API, hookami, JSX i sygnałami @preact/signals, także z biblioteką komponentów React przez preact/compat.
  • 100preact-stinger
    Buduje aplikacje i widgety w Preact 11: sygnały, migracja z React compat, osadzenia, wyspy Astro i Fresh.
  • 95developing-preact
    Wspiera tworzenie aplikacji w Preact z natywną architekturą i minimum zależności: składnia HTM, Web Components, parsowanie CSV i JSON, wizualizacje WebGL oraz importy ESM bez buildu.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.