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 で用意しておくことで上記のように簡単なコードで多言語対応できるようです。
覚えておくとよさそうですね。
スポンサード リンク
Advertisements
SITE PROFILE
最新のブログ記事(新着順)
- 15000以上のいい感じの線形アイコン「Lineicons」
- CSSやTailwindでのCSSスニペットライブラリ「CSS Snippets Library」
- AIを使ってサイトマップが作れる「Octopus.do」
- ライブラリ依存のないモーダルオープンライブラリ「Blendy」
- 個性的な明朝フリーフォント「築豊初号明朝OFL」
- CSSで太陽が差し込むようなアニメーション実装
- 可愛くアニメーションする「beautifully crafted animated icons」
- アイソメトリックなアイコンがアイコンがPNG,SVGでゲットできる「Isoicons」
- ユニークなカタカナフォントtorisippo
- 美しいメッシュグラデーションをCSSで簡単に取得できる「MSHR」
- 過去のエントリ