【发布时间】:2013-09-19 15:27:04
【问题描述】:
我对这个主题有点问题。
想象一下,我需要创建一个带有一些变量的模板:
<div class="main_text">
We would like to tell you that ...blah-blah...
<?php $username ?>
and after that we want to blah blah...
<?php $first_variable ?>
and
<?php $second_variable ?> etc.
<div>
我可以看到两种使用不同语言的方法:
- 为每种语言创建一个模板。它更快,但更多 代码。
-
以 codeigniter 的方式为字符串的每个部分创建语言常量,如下所示:
$lang['WE_WOULD_LIKE'] = 'We would like to tell you that ...blah-blah...'; $lang['AND_AFTER_THAT'] = 'and after that we want to blah blah...';
然后在解析模板时填充它。这种方式也不是最好的,小常数太多了。
也许有人知道更好的方法?请给我指路。
【问题讨论】:
标签: php codeigniter templates translation