db-missing-translations Add missing translations to the DB automatically

  1. Documentation
  2. Change Log

Basically this was not designed to be an extension but rather a tool for development stage where you do not want to manually add every single language string into the database messages table for each language you need the application to be translated to.

So what this does is basically a class that runs when the onMissingTranslation event raises and it checks if the message being translated exists in the source table, If not it adds it to the source messages table if it is then it skips this stage, The next stage is to check if this message exists in the messages table with the currently used language if it is then nothing is done if not then the message is added to the messages table for translation.

Note: It is highly recommended NOT to use this on a production environment as it run two queries for each message to check if it exists or not, Since i didn't plan this to be optimized and made this as a personal tool i have no plans updating this currently and is only released to help who ever needs such tool.



  • Yii 1.0 or above
  • Extract the 'MissingMessages.php' file in a directory you have imported.
  • Extract the 'SourceMessage.php' & 'Message.php' Model files under your models directory or any other directory your application imports it's contents.

Just add the following line to the 'messages' component array

'onMissingTranslation' => array('MissingMessages', 'load')

So it looks like this:

'messages' => array(
						'onMissingTranslation' => array('MissingMessages', 'load')

Change Log

May 2, 2010
  • Initial release.
5 1
1 313 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: Others
Developed by: Vince.
Created on: May 2, 2010
Last updated: 9 years ago


show all