I have a es.php
and a tl.php
in the i18n folder:
我在i18n文件夹中有一个es.php和一个tl.php:
es.php:
es.php:
<?php defined('SYSPATH') or die('No direct script access.');
return array(
'Good Morning' => 'Buenos Dias',
);
tl.php (is the abbreviation of a human language. No idea which one):
tl.php(是人类语言的缩写。不知道哪一个):
<?php defined('SYSPATH') or die('No direct script access.');
return array(
'Good Morning' => 'Magandang Umaga',
);
view file site.php
:
查看文件site.php:
<p><?php echo __('Good Morning'); // would produce 'Buenos dias'?></p>
I'm using Kohana 3. Right now, the only way known method to change the language is to modify I18n::lang('es-es');
in bootstrap.php
.
我正在使用Kohana 3.现在,改变语言的唯一方法就是修改I18n :: lang('es-es');在bootstrap.php中。
How can I change the preferred language when clicking in an anchor link (an anchor link inside site.php
)?
单击锚点链接(site.php中的锚点链接)时,如何更改首选语言?
1 个解决方案
#1
2
insert this in your before
method inside your main controller:
在主控制器内的before方法中插入:
I18n::$lang = 'es-es';
good example of how you can do this with cookies can be found inside the userguide module main controller
可以在userguide模块主控制器中找到如何使用cookie执行此操作的良好示例
#1
2
insert this in your before
method inside your main controller:
在主控制器内的before方法中插入:
I18n::$lang = 'es-es';
good example of how you can do this with cookies can be found inside the userguide module main controller
可以在userguide模块主控制器中找到如何使用cookie执行此操作的良好示例