Overview
WPZylos I18n provides internationalization with context-aware text domain handling.
Key Features
- Text Domain Loader - Load translations with
load_plugin_textdomain() - Translator Wrapper -
translate(),echo(),sprintf()with dynamic domain - Context Aware - Always uses
$context->textDomain()
Quick Start
use WPZylos\Framework\I18n\Translator;
use WPZylos\Framework\I18n\I18n;
// Load translations
I18n::loadFor($context);
// Translate strings
$translator = new Translator($context);
echo $translator->translate('Hello World');
$translator->echo('Welcome!');
API Reference
| Method | Parameters | Returns | Description |
|---|---|---|---|
I18n::loadFor | ContextInterface $context | bool | Load translations |
translate | string $text | string | Translate string |
echo | string $text | void | Echo translated |
plural | string $single, string $plural, int $count | string | Pluralize |
translateWithContext | string $text, string $context | string | With context |