Claude-skill-registry i18n-helper
Handle WordPress internationalization. Use when adding translatable strings.
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/i18n-helper" ~/.claude/skills/majiayu000-claude-skill-registry-i18n-helper && rm -rf "$T"
manifest:
skills/data/i18n-helper/SKILL.mdsource content
i18n Helper
Instructions
When adding translatable strings to the plugin:
- Use the correct text domain:
'retrologin' - Choose the right function:
- Return translated string__()
- Echo translated string_e()
- Return escaped translated stringesc_html__()
- Echo escaped translated stringesc_html_e()
- Return escaped for HTML attributesesc_attr__()
- Generate POT file:
composer run make-pot - Keep strings in English (US)
Translation Functions
| Function | Output | Use When |
|---|---|---|
| Return | Strings in PHP variables |
| Echo | Direct output |
| Return + escape | Displaying user content |
| Echo + escape | Direct output of user content |
| Return + escape | HTML attributes |
Example
// Basic usage __('Login Page', 'retrologin'); _e('Welcome back!', 'retrologin'); // With escaping esc_html__('Please log in to continue', 'retrologin'); esc_attr__('Username', 'retrologin'); // In attributes <input placeholder="<?php esc_attr_e('Enter username', 'retrologin'); ?>">
Generate Translations
# Generate POT file for translations composer run make-pot # POT file location: inc/languages/retrologin.pot
Guidelines
- Always include text domain second parameter
- Use escaping functions for user-generated content
- Keep strings concise for translation
- Avoid embedding variables in translatable strings