如何将挪威语添加到setlocale()? [英] How to add Norwegian to setlocale()?

查看:115
本文介绍了如何将挪威语添加到setlocale()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想添加挪威日期.这样我的网站上可以有两种语言.

I want to add Norwegian date. So that I can have two languages on my website.

根据PHP手册,它表示

According to PHP manual, it says that

setlocale()的返回值 取决于PHP是 跑步.它返回的正是 系统setlocale函数返回.

The return value of setlocale() depends on the system that PHP is running. It returns exactly what the system setlocale function returns.

如何添加挪威语?

谢谢.

我想使用setlocale()和strftime()如下. (适用于挪威语和英语)

I want to use setlocale(), and strftime() as followings. (for Norwegian and English)

setlocale(LC_TIME, "C");
echo strftime("%A");
setlocale(LC_TIME, "fi_FI");
echo strftime(" in Finnish is %A,");
setlocale(LC_TIME, "fr_FR");
echo strftime(" in French %A and");
setlocale(LC_TIME, "de_DE");
echo strftime(" in German %A.\n");

推荐答案

如果尚未安装挪威语言环境,则需要安装它.具体操作取决于您的服务器操作系统.

You would need to install the Norwegian locale, if it isn't installed yet. How to do that, depends on your server OS.

如果您显示的示例已经工作,并且/或者是挪威服务器,则很可能已经安装了该服务器.我会尝试使用no_NOno_NN(尼诺斯克)和no_NB(Bokmål)之一来解决问题.

If the examples you show work already, and/or it's a norwegian server, chances are it is already installed. I would try whether one of no_NO, no_NN (Nynorsk) and no_NB (Bokmål) does the trick.

不过,实际上,这些功能非常依赖底层操作系统的设置,并且语言代码/语言环境的处理方式因系统而异(因此给程序的配置增加了混乱!) ,已经说服了我使用基于PHP的库,例如 Zend_Locale 是更好的选择.

On a side note though, the very fact that these functions rely so heavily on the underlying OS's setup, and the way to address the language codes/locales varies from system to system (thus adding utter chaos to the program's configuration!), have convinced me that using a PHP-based library like Zend_Locale for this is the much better option.

我不确定开箱即用对挪威语的支持程度如何,但是我敢肯定,添加必要的资源很容易.

I'm not sure how well norwegian is supported by it out of the box, but I'm pretty sure adding the necessary resources is easy.

这篇关于如何将挪威语添加到setlocale()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆