Yii Framework Forum: When Should Use Of I18N In Application? - Yii Framework Forum

Jump to content

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

When Should Use Of I18N In Application? Rate Topic: -----

#1 User is offline   za_al 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 53
  • Joined: 06-March 12

Posted 28 June 2013 - 09:06 AM

Hi all


I'm developing an application that have one languege. but, I want to using Yii::t() to manage message in one file(for example protected/messages/fa).

my questions are :

1- "when should use of i18n in application?"

2- "Can I use Yii::t() just for site that have one languege to manage esealy message in code?"

3- "Is this practice has affect performance of site?"


tanks :)
0

#2 User is offline   KonApaz 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,327
  • Joined: 21-February 11
  • Location:Greece

Posted 28 June 2013 - 09:49 AM

1- "when should use of i18n in application?"
When it is nessesar to have multilingual messages

2- "Can I use Yii::t() just for site that have one languege to manage esealy message in code?"
what did you mean? give an example!


3- "Is this practice has affect performance of site?"
Yes slow down the performance, however you could use cache system
for example http://www.yiiframew.../1.1/CFileCache
Yii is the best php framework in the world!
find our demo Yii extension on www.webkit.gr
Is it post useful? please v++ ;)
0

#3 User is offline   za_al 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 53
  • Joined: 06-March 12

Posted 28 June 2013 - 12:17 PM

View PostKonApaz, on 28 June 2013 - 09:49 AM, said:


2- "Can I use Yii::t() just for site that have one languege to manage esealy message in code?"

what did you mean? give an example!



hi

tanks for your reply :)

for example in protected/message/default.php


<?php

return array(
' cannot be blank' => '...',

);
?>



and in all models :


  public function rules() {

        return array(
            array('username,password', 'required','on' => 'create',
                'message' => Yii::t('default','cannot be blank'),





so, when i going to edit messages, I just may need to edit file in "protected/message/default" instead edit all models or other files. In addition,I can easealy switch to another language or multiple language if necessary.

Nevertheless,I think this practice is Inappropriate. beacuse of slow down the performance and extra overhead.what's your opinion? :huh:
0

#4 User is offline   KonApaz 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,327
  • Joined: 21-February 11
  • Location:Greece

Posted 29 June 2013 - 03:53 AM

View Postza_al, on 28 June 2013 - 12:17 PM, said:

hi

tanks for your reply :)

for example in protected/message/default.php


<?php

return array(
' cannot be blank' => '...',

);
?>



and in all models :


  public function rules() {

        return array(
            array('username,password', 'required','on' => 'create',
                'message' => Yii::t('default','cannot be blank'),





so, when i going to edit messages, I just may need to edit file in "protected/message/default" instead edit all models or other files. In addition,I can easealy switch to another language or multiple language if necessary.

Nevertheless,I think this practice is Inappropriate. beacuse of slow down the performance and extra overhead.what's your opinion? :huh:



Hi @za_al

I use your approach in my application, so you could use in most cases!
A full translated site slow down the performance, so you could use cache to solve this problem.

Also to improve the performance you could use

1) for static pages you could use different files like that
protected/views/site/index.php
protected/views/site/el/index.php
protected/views/site/fe/index.php

2) for many translated texts you could split on partitions

create more one files like default.php, users.php, anotherpart.php and use

Yii::t('default','...'),
Yii::t('users','...'),
Yii::t('anotherpart','...'),

Yii is the best php framework in the world!
find our demo Yii extension on www.webkit.gr
Is it post useful? please v++ ;)
0

#5 User is offline   Totto Roncone 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 52
  • Joined: 12-September 13
  • Location:Il piacere - Europe

Posted 11 October 2013 - 07:15 AM

Thank both by share your impressions.

I am studing the better way to do the I18N by Yii.

Firstly, I studied the Internationalization by Yii at the same site (yiiframework).

I like the idea of how Yii help with I18N. It creates duplicate php files one for every folder associated to locale language (like KonApaz example number one)

The question is, ┬┐how do I resolved the cache problems? That this method slows down the load page, is sure.

Secondly, I studied the I18N the "gettext php translation" go with the POedit tool to create .po and .mo.

It is a good idea to because the duplicate files are plan text which will be loaded over view files in a fast way more.

But even though resolve the slowing down cache, this have another problem with cache and the replacement the text inside this.

Thanks in advance. :D
Thanks!
...Totto...
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