agentleFS
TairitsuaTairitsua/Monica/.agents/skills/monica-ui-localization/SKILL.md

monica-ui-localization

Skill13 starsChanged 7 months agoMITView on GitHub

This skill should be used when creating, modifying, validating, or reviewing Monica UI localization/i18n resources, replacing hardcoded user-facing text, adding IStringLocalizer usage, registering localized pages or navigation categories, synchronizing zh-CN/en-US JSON files, or running the Monica localization validator.

The file

We split this skill into the rules it gives an agent

11 rules. About 0 are common, 1 is distinctive, and 10 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 10

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    All script paths in this document are relative to the monica-ui-localization skill directory.

    line 10
  2. Very specific:

    Use decentralized module resources with marker class + JSON resource files under the project root Localization/ directory.

    line 15
  3. Very specific:

    Keep zh-CN.json and en-US.json synchronized for every changed resource.

    line 16
  4. Very specific:

    Prefer nested JSON objects and access them with colon-separated keys such as Page:Title or RuntimeConfigDialog:Intro.

    line 27
  5. Very specific:

    Do not use flat dot-style keys such as Page.Title for new Monica UI work.

    line 28
  6. Very specific:

    Prefer dependency-injected IStringLocalizer<TResource> in Razor components, pages, dialogs, state classes, support services, and any …

    line 29
  7. Very specific:

    Never use ambient or static localization access.

    line 30
  8. Very specific:

    Every localized page must use RegisterLocalizedPage<TPage, TResource>(...).

    line 33
  9. Very specific:

    Treat category identity and category text as separate contracts.

    line 35
  10. Distinctive:

    Never group by translated category labels.

    line 36
  11. Very specific:

    Read references/localization-guide.md when creating new resource files, debugging missing translations, adding parameterized strings, or …

    line 68

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Monica UI Localization

This skill owns Monica UI localization and i18n validation.

All script paths in this document are relative to the monica-ui-localization skill directory.

Required Workflow

  1. Replace every user-facing UI string with localization. Do not hardcode labels, button text, helper text, dialog text, snackbar messages, placeholders, table headers, empty states, or navigation/AppBar text.
  2. Use decentralized module resources with marker class + JSON resource files under the project root Localization/ directory.
  3. Keep zh-CN.json and en-US.json synchronized for every changed resource.
  4. Finish every i18n change by running the strict validator from the repository root:
python scripts/validate_localization.py --strict

The strict result must have zero JSON integrity errors, missing keys, invalid navigation resource keys, unused keys, and language sync issues. A non-strict PASSED result with unused-key warnings is not acceptable for completed i18n work.

Core Rules

  • Prefer nested JSON objects and access them with colon-separated keys such as Page:Title or RuntimeConfigDialog:Intro.
  • Do not use flat dot-style keys such as Page.Title for new Monica UI work.
  • Prefer dependency-injected IStringLocalizer<TResource> in Razor components, pages, dialogs, state classes, support services, and any DI-created service.
  • Never use ambient or static localization access. When DI is unavailable inside a helper or view model, accept an IStringLocalizer parameter or move the display behavior into a cohesive formatter that receives one.
  • Inject ILocalizationCatalog only for scenarios that genuinely need generic resource lookup. At application-composition boundaries such as endpoint metadata configuration, resolve the localizer or catalog from the current host's service provider so localization state never crosses host boundaries.
  • For page content, use the module-local resource marker and JSON files.
  • Every localized page must use RegisterLocalizedPage<TPage, TResource>(...). The page-title key lives in the owning module's TResource; no implicit or central page resource exists.
  • The owning module must contribute every navigation resource through module.Require<ModuleLocalization, ModuleLocalizationOption>(option => option.AddResource<TResource>()) in Describe, so direct and transitive inclusion behave identically.
  • Treat category identity and category text as separate contracts. Use BuiltInNavigationCategoryIds for the small shell-owned taxonomy, or call RegisterLocalizedCategory<TResource>(stableId, displayNameKey, order) once for a module-owned category and pass the returned ID to its pages.
  • Never group by translated category labels. Stable category IDs are case-insensitive, publisher-qualified for independent packages, and category order is explicit rather than culture-dependent.
  • RegisterLocalizedComponent and UIRegistryResource are obsolete architecture and must not appear in new or migrated code.
  • Resource marker classes and JSON folders stay under the project root Localization/ directory, not feature folders.

Validation Commands

Basic validation:

python scripts/validate_localization.py

Strict validation:

python scripts/validate_localization.py --strict

JSON output:

python scripts/validate_localization.py --strict --json

Validate another root:

python scripts/validate_localization.py --root <project-root> --strict

Reference

Read references/localization-guide.md when creating new resource files, debugging missing translations, adding parameterized strings, or fixing validator failures.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.