Home | 简体中文 | 繁体中文 | 杂文 | Github | 知乎专栏 | 51CTO学院 | CSDN程序员研修院 | OSChina 博客 | 腾讯云社区 | 阿里云栖社区 | Facebook | Linkedin | Youtube | 打赏(Donations) | About
知乎专栏多维度架构

11.24. i18n 国际化

11.24.1. 数组方式

这种方式流行于PHP语言,下面是一个例子

例 11.1. php language package

				
<?php
	$language['hello_world'] = 'hello world !!!'
?>
				
				

11.24.2. 数据库方式

数据库方式包括

  1. 其他非关系型收据库 (Berkeley DB)

  2. 对象/关系型收据库 ORDBMS (mysql)

Berkeley DB 是一个不错的选择,而且相对关系型数据库比较有优势。因为关系型数据库子并发数有限,连接资源很宝贵。

例 11.2. sql table language package

				
select id,key,value from language where country = 'zh-cn' and key = 'hello_world';
				
				

11.24.3. 文件文件

例如.ini文件

			
news=新闻
top10=前十位
			
			

11.24.4. Gettext

The gettext functions implement an NLS (Native Language Support) API which can be used to internationalize your PHP applications. Please see the gettext documentation for your system for a thorough explanation of these functions or view the docs at » http://www.gnu.org/software/gettext/manual/gettext.html.

11.24.5. 数据结构

数据结构方式主要包括

  1. 哈希表 hash table

  2. 类 class

  3. 字典 dict

  4. 图 map

[提示]提示

可能会用到序列化