Zend Frameworkの「Zend_Translate」で多言語対応のサイトを作るチュートリアル
2007年06月19日-
スポンサード リンク
Build Multi-lingual Websites With the Zend Framework
I've been lucky enough to have my book, "Beginning PHP and MySQL 5, Second Edition", translated into several languages, among them Chinese, Czechoslovakian, Polish and Russian.
Zend Frameworkの「Zend_Translate」で多言語対応のサイトを作るチュートリアル。
Zend FrameworkにはZend_Translateというクラスが付属しているようで、次のような使い方で多言語対応のサイトが作れます。
<?php
require_once("Zend/Translate.php");
$translate = new Zend_Translate('csv', "it.csv", 'it');
print "<h4>".$translate->_("Table of Contents")."</h4>";
print $translate->_("Chapter 1. An Introduction to PHP")."<br />";
print $translate->_("Chapter 2. Installing Apache and PHP")."<br />";
print $translate->_("Chapter 3. PHP Basics")."<br />";
print $translate->_("Chapter 4. Functions")."<br />";
print $translate->_("Chapter 5. Arrays")."<br />";
?>
別の言語ファイルを CSV で用意しておくことで上記のように簡単なコードで多言語対応できるようです。
覚えておくとよさそうですね。
関連の記事検索:PHP
スポンサード リンク
Advertisements
SITE PROFILE
最新のブログ記事(新着順)
- 2012年2月10日 管理人のブックマーク
- ブラウザ上でPDFを表示するJSライブラリ「PDF.js」
- 次世代の検索フォームを作成するjQuery&CSS3サンプル
- 2012年2月9日 管理人のブックマーク
- faviconを書き換えてfacebookの通知っぽくしてくれるfaviconアラート実装ライブラリ「Tinycon」
- ページめくりを実現するためのjQueryプラグイン集
- 2012年2月8日 管理人のブックマーク
- HTMLをアップするとCSSのスケルトンを自動生成してくれる「bearcss」
- HTML5で綺麗でインタラクティブなグラフが描けるライブラリ「Flotr2」
- 2012年2月7日 管理人のブックマーク
- 過去のエントリ



















間違いの指摘をしていただける方はメール、あるいはTwitterでお願いします(クリック)




