kasseler/gettext
最新稳定版本:1.0.1
Composer 安装命令:
composer require kasseler/gettext
包简介
Gettext library
关键字:
README 文档
README
Gettext *.mo files reader for PHP. Original package https://launchpad.net/php-gettext
Requirements
- PHP >= 5.3
Installation
$ composer require kasseler/config
Introduction
How many times did you look for a good translation tool, and found out that gettext is best for the job? Many times. How many times did you try to use gettext in PHP, but failed miserably, because either your hosting provider didn't support it, or the server didn't have adequate locale? Many times. Well, this is a solution to your needs. It allows using gettext tools for managing translations, yet it doesn't require gettext library at all. It parses generated MO files directly, and thus might be a bit slower than the (maybe provided) gettext library. PHP-gettext is a simple reader for GNU gettext MO files. Those are binary containers for translations, produced by GNU msgfmt.
Usage
To force the use of the class, you must install define:
define('GETTEXT_CLASS', true);
You must use the initialization function:
// filename locale charset init_translate_domain('message', 'fr', 'UTF-8', 'path_to_locales_dir');
Native
echo gettext('Add'); echo ngettext('Minute', 'Minutes', 2);
Usage class
echo _gettext('Add'); echo _ngettext('Minute', 'Minutes', 2);
统计信息
- 总下载量: 16
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL
- 更新时间: 2015-03-25