Localization
The framework supports WordPress localization files (POT and PO files).
By default, localization files should be stored in the folder [path to project]/assets/lang
.
Text Domain
Localization in WordPress works by text domains. These domains are attached to each custom text string found inside the code of a plugin or theme and help WordPress who will translate them.
WordPress expects the domain owner to provide it with PO language files that will be used for translations.
Define your text-domain based on your namespace. WordPress.org will assign you a text-domain (slug) if you plan to publish the project on their website.
Ayuco Command
Ayuco asks for a text-domain during the setup command.
Alternatively, the text domain can be changed by using the set command:
php ayuco set domain:{text-domain}
Configuration
Localization settings can be modified in the configuration file.
return [ // Other settings ... 'localize' => [ // Enables or disables localization 'enabled' => false, // Default path for language files 'path' => __DIR__ . '/../../assets/lang/', // Text domain 'textdomain' => 'my-app', // Unload loaded locale files before localization 'unload' => false, // Flag that indicates if this is a WordPress.org plugin/theme 'is_public' => false, ], // Other settings ... ];
Do not change the text-domain manually, use Ayuco instead.