WPZylos I18n

Internationalization with dynamic text domain and WordPress translation integration.

What You Get

  • Dynamic text domain — Uses context, not hardcoded strings
  • Translation loading — Automatic MO file loading
  • Translator class — Object-oriented translation API
  • Plural supportplural() wrapper with proper handling

Quick Start

use WPZylos\Framework\I18n\Translator;

$translator = new Translator($context);

// Localization (uses context's textDomain)
echo $translator->translate('Settings saved');
echo $translator->plural('1 item', '%d items', $count);

// With placeholders
echo $translator->sprintf(
    $translator->translate('Welcome, %s'),
    $userName
);

Why Dynamic Text Domain

Hardcoded text domains break PHP-Scoper builds and prevent multi-instance plugins:

// Bad: Hardcoded - breaks after scoping
__('Hello', 'my-plugin');

// Good: Dynamic from context - survives scoping
$translator->translate('Hello');

Documentation