如何使用 Poedit 翻译日期和月份?
How can I translate the days and months with Poedit?
我使用 Poedit 来翻译我的网站,但如果我像这样用 php 显示星期几和月份,我就不知道如何翻译它们:
$day_of_week_in_words->format("l")
如果您的服务器有 LC 语言库,您可以简单地使用 php 函数而无需任何 poedit 交互。您可以在此处找到详细信息 strftime
简单示例:
setlocale(LC_TIME, "fi_FI");
echo strftime(" in Finnish is %A,"); //%A means A full textual representation of the day Sunday through Saturday
setlocale(LC_TIME, "fr_FR");
echo strftime(" in French %A and");
setlocale(LC_TIME, "de_DE");
echo strftime(" in German %A.\n");
您可以使用 php date() 来执行此操作。
点这里manual/en/function.date.php
这样做
$day_of_week_in_words=date('N');//o/p as 4 means Thursday
$day_of_week_in_words=date('n');//o/p as 7 means July
我使用 Poedit 来翻译我的网站,但如果我像这样用 php 显示星期几和月份,我就不知道如何翻译它们:
$day_of_week_in_words->format("l")
如果您的服务器有 LC 语言库,您可以简单地使用 php 函数而无需任何 poedit 交互。您可以在此处找到详细信息 strftime 简单示例:
setlocale(LC_TIME, "fi_FI");
echo strftime(" in Finnish is %A,"); //%A means A full textual representation of the day Sunday through Saturday
setlocale(LC_TIME, "fr_FR");
echo strftime(" in French %A and");
setlocale(LC_TIME, "de_DE");
echo strftime(" in German %A.\n");
您可以使用 php date() 来执行此操作。
点这里manual/en/function.date.php
这样做
$day_of_week_in_words=date('N');//o/p as 4 means Thursday
$day_of_week_in_words=date('n');//o/p as 7 means July