Aide i18n WordPress

VérifiéSûr

Assure la gestion de l'internationalisation WordPress en imposant l'utilisation du domaine de texte 'retrologin' et les fonctions de traduction appropriées (__(), _e(), esc_html__(), etc.). Définit les bonnes pratiques pour les chaînes traduisibles, les échappements et la génération du fichier POT.

Spar Skills Guide Bot
DeveloppementDébutant
6002/06/2026
Claude CodeCursorWindsurfCopilotCodex
#wordpress#internationalization#i18n#translation

Recommandé pour

Notre avis

Ce skill aide à gérer l'internationalisation d'un plugin WordPress en utilisant le domaine de texte 'retrologin'.

Points forts

  • Indique les fonctions de traduction appropriées (__, _e, esc_html__, etc.)
  • Rappelle d'utiliser le domaine de texte correct
  • Fournit des exemples concrets pour PHP

Limites

  • Spécifique au domaine 'retrologin'
  • Ne couvre pas la gestion des fichiers PO/MO
  • Ne traite pas du chargement des fichiers de langue
Quand l'utiliser

Lors de l'ajout de chaînes traduisibles dans un plugin WordPress utilisant le domaine 'retrologin'.

Quand l'éviter

Pour des projets sans internationalisation ou utilisant un autre domaine de texte.

Analyse de sécurité

Sûr
Score qualité95/100

The skill only provides informational guidance on WordPress internationalization functions and a standard composer build command. It does not execute any code or declare any tools that pose a security risk.

Aucun point d'attention détecté

Exemples

Basic translatable string
Add a translatable string 'Login Page' using the retrologin domain with the appropriate translation function.
Escaped attribute translation
Create an input placeholder with a translatable string 'Enter username' escaped for attributes using the retrologin domain.
Generate POT file
Generate the POT file for translations by running composer run make-pot.

name: i18n-helper description: Handle WordPress internationalization. Use when adding translatable strings.

i18n Helper

Instructions

When adding translatable strings to the plugin:

  1. Use the correct text domain: 'retrologin'
  2. Choose the right function:
    • __() - Return translated string
    • _e() - Echo translated string
    • esc_html__() - Return escaped translated string
    • esc_html_e() - Echo escaped translated string
    • esc_attr__() - Return escaped for HTML attributes
  3. Generate POT file: composer run make-pot
  4. Keep strings in English (US)

Translation Functions

| Function | Output | Use When | | ---------------------------- | --------------- | ----------------------------- | | __($text, $domain) | Return | Strings in PHP variables | | _e($text, $domain) | Echo | Direct output | | esc_html__($text, $domain) | Return + escape | Displaying user content | | esc_html_e($text, $domain) | Echo + escape | Direct output of user content | | esc_attr__($text, $domain) | 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
Skills similaires