HomeDeveloper docsLanguage package: Portuguese and Spanish catalogs
Examples by kind 3 min read

Language package: Portuguese and Spanish catalogs

A minimal installation-wide language package with valid catalogs, activation and English fallback.

Goal and prerequisites

Ship a deliberately partial catalog for six original interface strings in pt-BR and es. This demonstrates package structure and fallback; it is not a complete translation or a replacement release of the official Translator.

Target host: 0.3.0, SDK 1.0.0. Sample interface strings are English. Preserve the requested version when adapting.

Complete files

Download source package ZIP

These are complete unsigned sources. After reviewing the code, test with Install from ZIP on a disposable host. Marketplace publication uses the signature/catalog described in signing and activation. No private signing key is included.

Complete manifest

json
{
  "id": "example.language-demo",
  "name": "Example language demo",
  "version": "1.0.0",
  "sdk": {
    "requires": ">=1.0.0 <2.0.0",
    "tested": "1.0.0"
  },
  "description": "Partial original interface catalogs for Portuguese and Spanish.",
  "author": "Gravewright documentation examples",
  "license": "GPL-3.0-only",
  "entry": "main.mjs",
  "locales": {
    "pt-BR": {
      "name": "Português (Brasil)",
      "path": "locales/pt-BR.json"
    },
    "es": {
      "name": "Español",
      "path": "locales/es.json"
    }
  }
}

Example code

main.mjs

javascript
export default { start() {}, register() {}, stop() {} };

locales/pt-BR.json

json
{
  "Actors": "Personagens",
  "Items": "Itens",
  "Settings": "Configurações",
  "Close": "Fechar",
  "Save": "Salvar",
  "Search": "Buscar"
}

locales/es.json

json
{
  "Actors": "Personajes",
  "Items": "Objetos",
  "Settings": "Ajustes",
  "Close": "Cerrar",
  "Save": "Guardar",
  "Search": "Buscar"
}

How to run

  1. Use an isolated host with no other globally enabled language package providing these locales. As owner, review/install the source ZIP through Modules → Install from ZIP, then enable it for the installation.

  2. Choose Portuguese or Spanish in account Settings and reload the page. Native strings present in the catalogs can translate; absent strings stay English.

  3. Disable the example and reload. Confirm English fallback and that campaign-authored names did not change.

Expected result and lifecycle

locales is package metadata, not a kind field. The no-op browser entry satisfies the browser package contract but does not mount a campaign module. Do not combine system and locales or include en as an override.

Errors and limits

Invalid locale/catalog JSON, altered interpolation placeholders or a system/locales combination are rejected at installation. Global activation is owner-only. Installed language catalogs are omitted from campaign module selection.

How to validate

  • Validate both nonempty catalogs with the native catalog validator.

  • Switch accounts and ensure each retains its explicit locale choice.

  • Check untranslated strings fall back to English and authored text remains unchanged.

How to use AI with this example

text
Expand the language-demo catalogs with [interface strings] from the current host. Preserve placeholders and English fallback, use pt-BR/es matching keys, and leave authored content and exact legal notices unchanged. Validate with the native catalog parser and real account language switching.