My Google+ Profile

Friday 21 December 2012

Multi-language site in yii framework

To make multi language in your yii framework you have to implements some rules. You can use the session variables to make the translation between your page. With the the documentation you can look at here.

I have to implements this to make the translation page. You can follow the instruction in that articles that not almost I discuss in this page.

But when I finish implement that step, I can make my own translation page on the protected/messages/<your language id>/<your category>.php files..

For the example :

../protected/messages/id/translation.php

The example of the translation page that I use like this

<?php
/**
 * Indonesian translate
 */
return array(
  //------MENU------------//
  'Home'=>'Beranda',
  'About'=>'Tentang',
  'Contact'=>'Kontak',
  'Login'=>'Masuk',
  'Logout'=>'Keluar',
   
   
   
  //----------- Other Example ------------------//
  'What are You Looking For?'=>'Apa Yang Anda Cari?',
  'Sell Your Products'=>'Mau Menjual Barang',
  'Products'=>'Barang',
  'Services'=>'Jasa'
   
  );
?>


Oke when you finish that I use my native languages (Indonesian=ID) and than I can use that for my translation in my code using this example in your view files.

echo Yii::t('translation','Home');

2 comments:

  1. Website translation is a lucrative business that translators should be prepared to take advantage of, especially as more and more companies become interested in making their brand global.

    Multilingual websites

    ReplyDelete
  2. Hi there, awesome site. I thought the topics you posted on were very interesting. I tried to add your RSS to my feed reader and it a few. take a look at it, hopefully I can add you and follow.

    Angularjs Development Company - Nintriva

    ReplyDelete