statikbe / craft-translate
Translate static string from the Craft control panel
Installs: 12 542
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 10
Forks: 0
Open Issues: 4
Type:craft-plugin
Requires
- craftcms/cms: ^5.0.0-alpha.1
Requires (Dev)
- codeception/codeception: ^5.0.0
- codeception/module-asserts: ^2.0.0
- codeception/module-yii2: ^1.1.8
- vlucas/phpdotenv: ^3.0
This package is auto-updated.
Last update: 2024-10-28 18:44:41 UTC
README
Translate static string from the Craft control panel
Requirements
This plugin requires Craft CMS 4.0.0 or later.
Installation
To install the plugin, follow these instructions.
-
Open your terminal and go to your Craft project:
cd /path/to/project
-
Then tell Composer to load the plugin:
composer require statikbe/craft-translate
-
In the Control Panel, go to Settings → Plugins and click the “Install” button for Translate.
Plugin & module translations
From version 1.3.0 onwards, translations for plugins and modules can now be saved in your site as well.
This can be done by adding the following event to your plugin file:
use statikbe\translate\elements\Translate; use statikbe\translate\events\RegisterPluginTranslationEvent; Event::on( Translate::class, Translate::EVENT_REGISTER_PLUGIN_TRANSLATION, function (RegisterPluginTranslationEvent $event) { $event->plugins['plugin-handle'] = \Craft::$app->getPlugins()->getPlugin('plugin-handle'); } );
Translations for the plugin will then be saved in site\translations\locale\plugin-handle.php
Brought to you by Statik, heavily inspired by boboldehampsink/translate.