I use Craft on multilingual site and I'm having some difficulty in getting the static messages on templates added or changed on every translation file I have.

Is there any way to extract those static messages changed or not already translated from templates into all translation files?

I'm looking for a functionality like of "yiic message" which searches for messages to be translated in the specified source files and compiles them into PHP arrays as message source.



For Craft 3, we use the Yii 2 Inspections plugin for PhpStorm to do this now. https://plugins.jetbrains.com/plugin/9400-yii2-inspections

There is a translation inspection that will let you know which strings are missing translations and which translations are no longer in use.


We currently have our own command line tool that goes through all of Craft's files and extracts anything in Craft::t() (for PHP), and |t (for Twig) and Craft.t() for JavaScript.

What we would probably do is make that tool into a yiic command and update it to let plugins take advantage of it for their own files as well.

Will add it to the list.

| improve this answer | |
  • 1
    is there a chance that you are going to share that cli with the rest of the world? – Peter Piper Dec 21 '18 at 14:27
  • 1
    Updated answer @PeterPiper – Brad Bell Dec 22 '18 at 0:20

The Translate plugin does what you need, it scans templates and plugins, and also provides an interface for translation.

| improve this answer | |
  • unfortunately the translate plugin isn't maintained anymore. – Peter Piper Dec 21 '18 at 14:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.