agentsclimarketplace

Add translations

Skill anoopsg/agent_rules/src/exclusive/skills/add-translations

Behavioral blueprints for agents.

Install
npx -y skills add anoopsg/agent_rules --skill add-translations

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Use when adding or modifying translation keys, localized strings, i18n keys, or errors. Handles en.i18n.json, ar.i18n.json, and melos run translate.

SKILL.md

2.1 KB, as published. Nobody here has run it

Internationalization Skill

This skill defines the process for adding, modifying, and using localized strings in the project. The project uses slang for internationalization.

1. Directory Structure

Translation source files are located in lib/i18n/:

lib/i18n/
├── en.i18n.json         # English translations (source locale)
└── ar.i18n.json         # Arabic translations

2. Formatting Guidelines

Follow these rules when adding or modifying translations:

  • Key Naming: Use camelCase for translation keys.
  • Namespacing: Organize keys by features or common namespaces.
  • Sync: Ensure every key added to en.i18n.json is also added to ar.i18n.json to keep them in sync.
  • Placeholders: Use ${variableName} syntax for dynamic placeholders.

2.1 JSON Example

{
  "auth": {
    "login": "Login",
    "welcome": "Welcome, ${name}!"
  },
  "errors": {
    "myError": "Something went wrong."
  }
}

3. Registering Error Codes

When translating errors, the translation key must match the technical error code defined in Dart:

  1. Add the code to lib/src/infrastructure/error_codes.dart:
    enum AppErrorCode implements ErrorCode {
      myError('myError'),
    }
    
  2. Add the translation under the errors key in translation JSONs:
    "errors": {
      "myError": "A localized description of the error."
    }
    

4. Re-generating Translations

After modifying JSON files, run the translation tool to generate updated Dart types:

melos run translate

5. Usage in Code

To avoid repeated access overhead, assign context.$.tr to a local variable (e.g., tr) when accessing translations inside build methods:

final tr = context.$.tr;

// Basic usage
Text(tr.auth.login)

// With placeholders
Text(tr.auth.welcome(name: 'User'))

// For failure mapping
final message = failure.toError(tr);

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.