wok-ui-i18n

Centralize multilingual UI text with language switching and placeholder formatting.

Updated Sep 14, 2023
One-click install
npx skills add https://github.com/PeakTai/wok-ui --skill wok-ui-i18n
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: wok-ui-i18n
Source: https://github.com/PeakTai/wok-ui/tree/main/skills/wok-ui-i18n
Command: npx skills add https://github.com/PeakTai/wok-ui --skill wok-ui-i18n

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

wok-ui internationalization (i18n) simplifies managing multilingual UI text across a wok-ui project. It provides a centralized way to define messages, switch languages, and build runtime strings.

Core Features & Use Cases

  • Built-in messages for en-US and zh-CN; easy extension with project-specific phrases.
  • Language switching via getI18n/setLang, with sync extensions and lazy loading for additional languages.
  • Message construction with buildMsg and support for placeholders, plus optional extension I18n for project-specific keys.

Quick Start

Install and initialize the i18n module, then use getI18n() to access the global i18n instance and proceed to set messages and switch language.

Frequently Asked Questions about wok-ui-i18n

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

FAQPage Schema
How do I add internationalization to a wok-ui project for dynamic language switching?

Internationalization in a wok-ui project is handled by a centralized i18n system using getI18n and setLang. It enables safe, synchronized language switching for dynamic UI text updates without unsafe external dependencies.

How does message formatting with placeholders work for multilingual UI text?

Message formatting with placeholders uses the buildMsg function to construct runtime strings. It allows injecting dynamic values into predefined multilingual templates defined within the centralized message repository.

Can I load additional languages asynchronously for wok-ui internationalization?

Yes, wok-ui internationalization supports lazy loading for additional languages. It handles both synchronous and asynchronous language loading while maintaining safe, synchronized language switching across the application.

How do I extend the built-in i18n messages with project-specific phrases?

You extend built-in en-US and zh-CN messages using the setMsgs function and an optional extended I18n module. This allows defining project-specific keys alongside the default multilingual phrases.

Do I need external dependencies to manage translations in wok-ui?

No, wok-ui translations require no unsafe external dependencies beyond the runtime i18n components. The system operates safely using its built-in centralized message management and synchronization mechanisms.