Strange Problems With I18N Cdbmessagesource

Hi All,

I’m having some weird issues when I translate content from db tables. I have two tables, source and message where there is a message like this “Is $10,000 the minimum…” but it shows this: “$1, the minimum”.

This happens only with numbers, if I save this message on db "1, 5, 10, 25, 35, 70, 100", it shows "1, 5, 1, 25, 35, 7, 1".

I just have no idea why this is happening, it is really strange to me, if someone can help, it will be so much appreciate.

config/main.php




            //i18 International

	 'db_i18n' => array(

            'class' => 'CDbMessageSource',

            'connectionID' => 'db',

            'sourceMessageTable' => 'trad_source',

            'translatedMessageTable' => 'trad_message',

            'cachingDuration' => (YII_DEBUG ? 0 : 360),

         ), 



In the view I use:




<?php            

                    $this->beginWidget('CMarkdown', array('purifyOutput'=>true));

                        echo Yii::t('blog',$model->content,null,'db_i18n');

                    $this->endWidget();

                ?>



tables:




CREATE TABLE trad_source(

    id INTEGER PRIMARY KEY AUTO_INCREMENT,

    category VARCHAR(32),

	fk_id INTEGER NULL,

	parameter VARCHAR(32) NULL,

    message TEXT

)ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


CREATE TABLE trad_message(

    id INTEGER,

    language VARCHAR(16),

	category VARCHAR(32),

	fk_id INTEGER NULL,

	parameter VARCHAR(32) NULL,

    translation TEXT,

    PRIMARY KEY (id, language),

    CONSTRAINT FK_trad_message_trad_source FOREIGN KEY (id)

         REFERENCES trad_source (id) ON DELETE CASCADE ON UPDATE RESTRICT

)ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;



DB records:





INSERT INTO post (title, content, status, create_time, update_time, author_id, tags) VALUES ('Post text', 'Is $10,000 the minimum...', 2, '1382370338', '1383752295', 1, 'test');


INSERT INTO trad_source (category, fk_id, parameter, message) VALUES ('blog',1,'Title','Post text');

INSERT INTO trad_source (category, fk_id, parameter, message) VALUES ('blog',1,'Content','Is $10,000 the minimum...');


INSERT INTO trad_message (id, language, category, fk_id, parameter, translation) VALUES (1,'es','blog',1,'Title','Prueba post');

INSERT INTO trad_message (id, language, category, fk_id, parameter, translation) VALUES (2,'es','blog',1,'Content','10.000€ es el mínimo...');



If I change the language into English it shows:

Blog title: Post test

Blog content: Is $1, the minimum…

If I change the language into Spanish it shows:

Blog title: Prueba post

Blog content: 1.€ es el mínimo…

Firs of all, try to remove markdown widget to make sure it’s the translator

Yes, I removed it keeping only the translator, same result. Even I removed the translator and the message showed correctly, but obviously without translation.

Thanks for your interest ORey, I appreciate it.

You pass null as the params. If you don’t want any params, pass an empty array. Params always should be an array. I don’t know if it will change anything, just nothing else caught my eye when scanning the code.

nineinchnick, you made my day! that was the problem! I didn’t realize! Thanks!