3

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.

2 Answers 2

6

Update:

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.


Old:

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.

2
  • 1
    is there a chance that you are going to share that cli with the rest of the world? Commented Dec 21, 2018 at 14:27
  • 1
    Updated answer @PeterPiper
    – Brad Bell
    Commented Dec 22, 2018 at 0:20
3

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

1
  • unfortunately the translate plugin isn't maintained anymore. Commented Dec 21, 2018 at 14:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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