https://github.com/statikbe/craft-translate
Adds static string translations to Craft's Control Panel
https://github.com/statikbe/craft-translate
craft-plugin craft3 craftcms
Last synced: 3 months ago
JSON representation
Adds static string translations to Craft's Control Panel
- Host: GitHub
- URL: https://github.com/statikbe/craft-translate
- Owner: statikbe
- License: mit
- Created: 2018-08-17T09:48:51.000Z (almost 8 years ago)
- Default Branch: develop
- Last Pushed: 2025-02-28T17:45:16.000Z (over 1 year ago)
- Last Synced: 2025-08-21T00:58:52.357Z (10 months ago)
- Topics: craft-plugin, craft3, craftcms
- Language: PHP
- Homepage:
- Size: 201 KB
- Stars: 0
- Watchers: 8
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Translate for Craft CMS 4.x
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.
1. Open your terminal and go to your Craft project:
cd /path/to/project
2. Then tell Composer to load the plugin:
composer require statikbe/craft-translate
3. 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:
```php
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](https://www.statik.be), heavily inspired by [boboldehampsink/translate](https://github.com/boboldehampsink/translate).