Yii Framework Forum: how to use this extention (multilang) - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

how to use this extention (multilang) Rate Topic: -----

#1 User is offline   abedi98 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 86
  • Joined: 29-August 11

Posted 28 May 2012 - 12:09 PM

hi friend's
how to use this extention : http://www.yiiframew...i-multilanguage
???
0

#2 User is offline   ngonhan 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 20-December 12

Posted 09 January 2013 - 06:08 AM

View Postabedi98, on 28 May 2012 - 12:09 PM, said:

hi friend's
how to use this extention : http://www.yiiframew...i-multilanguage
???


The wiki don't write about the case we need inserting, updateing multilang data records.
When insert it will use main (Post) model's fields (ex: title) as default value for (PostLang),
and insert into post_lang 3 records, but blank l_title for the other languages.

After read the MultilangBehavior code I figured out we can simply handle this:

// Assume default lang is en
$model = new Post();
....
// With title is one of localizedAttributes and 'languages'=>array ('en', 'ja', 'vi');
$model->ml->setLangAttribute('title_ja', 'In Japanese Post title');
$model->ml->setLangAttribute('title_vi', 'In Vietnamese Post title');
....
$model->save();


Hope this help.
0

#3 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 09 January 2013 - 10:37 AM

/* moved from General Discussion */
"Less noise - more signal"
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users