Difference between #4 and #5 of
Using SQLite and CDbMessageSource as a module

Revision #5 has been created by pheadeaux on Jun 26, 2012, 3:26:25 PM with the memo:

added working example
« previous (#4)

Changes

Title unchanged

Using SQLite and CDbMessageSource as a module

Category unchanged

How-tos

Yii version unchanged

Tags changed

multilanguage, i18n, sqlite, dvcs, mercurial, git

Content changed

[...]
));
?>
```
I tried to melt it down to the only necessary code. But if you go over it, you should not see nothing new. Pretty much straight forward.

Working example
 
------------------
 
So how to use this setup? Answer: the same way as with [CDbMessageSource]. E.g. create a new entry called `#home#`, select the category `App` and past in some text for `de` and `en`. To display that text simply use:
 
 
```php 
<?php echo Yii::t('App', '#home#', array(), 'i18n');?>
 
```
 
Where `i18n` is the reference to our `protected\config\main.php` setup. Not the module name but the `components\i18n` array. To switch the language, simply switch the language settings in the `protected\config\main.php` - or use you favorite method (cf. [Setting and maintaining the language in Application (i18n)](http://www.yiiframework.com/wiki/26/setting-and-maintaining-the-language-in-application-i18n) ).
 
 
Going live and DVCS
------------------


Now that everything is set up there is only one thing to pay attention to: the file and folder access rights. Since the `i18n.sqlite` is buried deep in the application tree the folder `protected\modules\i18n\data` has to be chmod 755. That works fine until you firstly push and pull your DVCS.
[...]
3 0
9 followers
Viewed: 22 634 times
Version: 1.1
Category: How-tos
Written by: pheadeaux
Last updated by: pheadeaux
Created on: Jun 26, 2012
Last updated: 12 years ago
Update Article

Revisions

View all history