PHP gettext翻译可用的字符串部分

时间:2015-01-27 19:17:40

标签: php translation gettext

我有一个网站,我们用英语保存了一些描述。我们想用其他语言翻译它们,如法语,中文等。

我的字符串是

Call Consumption period before the 2015-01-27
Maintenance of Phone Numbers Quantity 10

我的翻译是这样的

msgid "Call Consumption period before the"
msgstr "Período de consumo de llamadas antes de la"

msgid "Maintenance of Phone Numbers Quantity"
msgstr "Mantenimiento de los números de teléfono Cantidad Wrong"

我想翻译它并忽略日期和数字部分我该怎么做。

1 个答案:

答案 0 :(得分:0)

要翻译日期,

例如,您可以像这样放置一个开关盒

switch ($lang) {
case 'en':
    setlocale(LC_TIME, 'en_CA.UTF-8');
    echo strftime("%B %e, %G");
    break;
case 'fr':
    setlocale(LC_TIME, 'fr_CA.UTF-8');
    echo strftime("%e %B %G");
    break;

}

您查看网站的语言,并根据iso显示日期。

这只是一个我不知道它是否是更好的解决方案的想法。