Using the t() function with databases?

The database for my Yii application has two tables for translating words and short messages. One, called “labels” contains the keyword’s id and name, while the other, “labelsLang”, contains the translated keywords. The structure looks like this;


CREATE TABLE IF NOT EXISTS `labels` (

  `id` int(10) NOT NULL AUTO_INCREMENT,

  `tag` varchar(200),

  PRIMARY KEY (`id`)

)


INSERT INTO `labels` (`id`, `tag`) VALUES

(1, 'Welcome'),

(2, 'Goodbye'),

(3, 'Thank you'),...


CREATE TABLE IF NOT EXISTS `labelsLang` (

  `l_id` int(10) NOT NULL AUTO_INCREMENT,

  `label_id` int(10) NOT NULL,

  `lang_id` varchar(6),

  `l_tag` varchar(200),

  PRIMARY KEY (`l_id`),

  KEY `lang_id` (`lang_id`),

  KEY `traduction_id` (`label_id`)

)


INSERT INTO `smcms_traductionslang` (`l_id`, `label_id`, `lang_id`, `l_tag`, `l_val`) VALUES

(1, 1, 'fr', 'Bienvenue'),

(2, 1, 'en', 'Welcome'),

(3, 1, 'es', 'Hola'),

(4, 1, 'it', 'Buongiorno'),

(5, 2, 'fr', 'Au revoir'),...

I’d like to be able to use the t() function to translate these keywords throughout the site, as I heard it’s incredibly useful and everything, but I haven’t found any examples on how to do this. Could anyone help me out with this, please?

Have you tried using the CDbMessageSource class?

http://www.yiiframework.com/doc/api/1.1/CDbMessageSource/