定制 agl/more-locale 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

agl/more-locale

Composer 安装命令:

composer require agl/more-locale

包简介

AGL Framework / I18n module.

README 文档

README

Additional I18n module for AGL Framework.

Installation

Run the following command in the root of your AGL application:

php composer.phar require agl/more-locale:*

Configuration

Configuration file

Edit app/etc/config/more/locale/main.php to configure the module.

Gettext files

Create also Gettext files for each language you wish to use, for example:

app/etc/locale/en_GB.utf8/LC_MESSAGES/default.mo app/etc/locale/en_GB.utf8/LC_MESSAGES/default.po

app/etc/locale/fr_FR.utf8/LC_MESSAGES/default.mo app/etc/locale/fr_FR.utf8/LC_MESSAGES/default.po

Usage

Select language

If you don't use a domain name per language, start your URLs with the language code you want to use. For example: http://domain.tld/en/ or http://domain.tld/fr/.

Display i18n string (GetText syntax)

echo _("String");

Get current language

Agl::getSingleton('more/locale')->getLanguage();

Get accepted languages

Agl::getSingleton('more/locale')->getAcceptedLanguages();

Create an URL with a specific language

Instead of calling Agl::getUrl(), which uses the current language, call the following method with a $pLang parameter.

Agl::getSingleton('more/locale')->getUrl($pPath, $pParams, $pRelative, $pLang);

For example:

Agl::getSingleton('more/locale')->getUrl('game/upload', array(), true, 'fr');

统计信息

  • 总下载量: 33
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-01-14