title: Yii Localisation - CDbMessageSource example
body: <p>I'm newbie to Yii. Official documentation does not give any examples for CDbMessageSource.
  Questions:
  1) How/Where do I set CDbMessageSource as my MessageSource ?</p>
  
  <p>2) In my current application I store Categories in one table and translations for Categories in other table. Tables structure:</p>
  
  <pre><code>CATEGORY
  ----------  
  cat_id  (PK)
  
  CATEGORY_TRANSLATION
  --------------------    
  cat_id  (FK)
  en
  ru
  </code></pre>
  
  <p>Now if I introduce sub-categories I would model DB this way:</p>
  
  <pre><code>SUB_CATEGORY
  ------------
  sub_cat_id (PK) 
  cat_id  (FK)
  
  SUB_CATEGORY_TRANSLATION
  ------------------------
  sub_cat_id (FK) 
  en
  ru
  </code></pre>
  
  <p>Do I understand it correctly that in Yii if I want to use CDbMessageSource to store translations then I would need to merge CATEGORY &amp; SUB_CATEGORY in to one table , then merge CATEGORY_TRANSLATION &amp; SUB_CATEGORY_TRANSLATION in to other so that in result I get following structure (taken from here <a href="http://www.yiiframework.com/doc/api/1.1/CDbMessageSource" rel="nofollow">http://www.yiiframework.com/doc/api/1.1/CDbMessageSource</a>) :</p>
  
  <pre><code>CREATE TABLE SourceMessage
  (
      id INTEGER PRIMARY KEY,
      category VARCHAR(32),
      message TEXT
  );
  CREATE TABLE Message
  (
      id INTEGER,
      language VARCHAR(16),
      translation TEXT,
      PRIMARY KEY (id, language),
      CONSTRAINT FK_Message_SourceMessage FOREIGN KEY (id)
           REFERENCES SourceMessage (id) ON DELETE CASCADE ON UPDATE RESTRICT
  );
  </code></pre>
  
  <p>Thank you !</p>