Externalizing and Translating Text

Externalize Go and HTML template strings into a localized text.yaml bundle.

172|5|Updated Sep 9, 2022
One-click install
npx skills add https://github.com/microbus-io/fabric --skill externalizing-and-translating-text
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Externalizing and Translating Text
Source: https://github.com/microbus-io/fabric/tree/main/.claude/skills/microbus/i18n
Command: npx skills add https://github.com/microbus-io/fabric --skill externalizing-and-translating-text

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Externalizes end-user strings into a localized resource bundle to enable translation and localization across services and templates.

Core Features & Use Cases

  • Create a text.yaml bundle under resources to hold localized strings.
  • Map strings to per-language keys (en, fr, es, etc.) and integrate with code.
  • Update Go files and templates to load localized strings at runtime.
  • Document and version the translations for consistent releases.

Quick Start

Step 1: Create a text.yaml under the resources directory of your microservice. Step 2: Identify end-user strings in Go files and templates and add entries in text.yaml with per-language localizations. Step 3: Implement loading in code using svc.MustLoadResString(ctx, "Key") and ensure templates consume the localized value. Step 4: Reference localized strings in templates via a map obtained from svc.MustLoadResStrings(ctx). Step 5: Document translation requirements in AGENTS.md and version the translation bundle.

Frequently Asked Questions about Externalizing and Translating Text

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I externalize UI text strings into a translation bundle for Go microservices?

To externalize and translate Go strings, create a text.yaml file under resources, define per-language keys for end-user strings, and reference them in code via svc.MustLoadResString and in templates via svc.MustLoadResStrings.

What is the process for localizing HTML templates with i18n text bundles?

Localizing HTML templates involves defining per-language keys in a text.yaml bundle and consuming the localized values via a map obtained from svc.MustLoadResStrings during template rendering.

Can I use this string externalization approach for multiple languages in Go code?

Yes, string externalization supports multiple languages by mapping end-user strings to per-language keys like en, fr, and es within a text.yaml bundle loaded at runtime by Go code.

How do I manage translation versions across microservices?

Manage translation versions by documenting requirements in AGENTS.md and versioning the text.yaml translation bundle to ensure consistent microservice releases.

Do I need any external dependencies to set up i18n text bundles for Go?

No external dependencies are required; the i18n workflow relies on creating a text.yaml file and loading localized strings using built-in service methods like svc.MustLoadResString.