搜索

PythonReactSEOPDF
GitHub Skill

add-i18n

Generate or update internationalization (i18n) locale files for an Ybyra domain. Use when the user asks to add translations, create locale files, or update labels for a domain's fields, groups, and actions.

devitools☆ 2 仓库 Stars0 仓库 Forks

安装与使用

请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。

查看来源 ↗使用指南

技能说明

Add i18n Translations

When to Use

  • User asks to create translations for a new domain
  • User asks to add or update labels for fields, groups, or actions
  • User asks to create a locale file

Steps

  1. Identify the domain and fields from the schema definition
  2. Create the locale file at settings/locales/pt-BR.ts (or the target locale)
  3. Add entries for every field, group, and custom action in the schema
  4. Register the locale in the i18n setup file

Locale Structure

Every domain locale must include:

export const ptBR = {
  {domain}: {
    title: "{Domain Title}",
    fields: {
      // One entry per field in the schema
      {fieldName}: "{Label}",
      "{fieldName}.placeholder": "{Placeholder text}",  // optional
    },
    groups: {
      // One entry per group in the schema
      {groupName}: "{Group Label}",
    },
    actions: {
      // Only custom actions (not standard CRUD)
      {actionName}: "{Action Label}",
    },
  },
};

Rules

  • Every field in the schema MUST have a label entry
  • Placeholders are optional but recommended for text inputs
  • Standard actions (add, view, edit, create, update, cancel, destroy) use common.* keys from @ybyra/core
  • Only custom actions need domain-specific labels

Example (pt-BR)

// settings/locales/pt-BR.ts
export const ptBR = {
  person: {
    title: "Pessoa",
    fields: {
      id: "ID",
      name: "Nome",
      "name.placeholder": "Digite seu nome aqui",
      email: "E-mail",
      birthDate: "Data de Nascimento",
      active: "Ativo",
    },
    groups: {
      basic: "Informações Básicas",
      address: "Endereço",
    },
    actions: {
      custom: "Enviar",
    },
  },
};

Merge with core translations:

import { ptBR } from "@ybyra/core";
import { ptBR as local } from "./locales/pt-BR";

const merged = { ...ptBR, ...local };

使用示例

查看来源仓库中的使用示例与配置说明。

查看来源 ↗

来源历史

收录时间
2026-03-11
索引更新时间
2026-03-11
Branch
main

收录与同步日期属于本站记录。源码修改历史请查看来源仓库。

GitHub ↗

chat Comments (0)

chat_bubble_outline

No comments yet. Be the first to share your thoughts!