ashrafakl/yii2-locale 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

ashrafakl/yii2-locale

最新稳定版本:v1.0.3

Composer 安装命令:

composer require ashrafakl/yii2-locale

包简介

The yii2-locale extension represents the data relevant to a locale such as countries, languages, and orientation.

README 文档

README

Locale class represents the data relevant to a locale such as countries, languages, and orientation.

This class uses and depend on the PHP intl extension.

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist ashrafakl/yii2-locale "~1.0.3"

or add

"ashrafakl/yii2-locale": "~1.0.3"

to the require section of your composer.json file.

Usage

Once the extension is installed then add this to your application configuration:

<?php
return [
    // ...
    'components' => [
        // ...
        'locale' => [
            'class'=> 'ashrafakl\localization\Locale',
        ],
        // ...
    ]
];

Public properties

Name Description
bundlename Path of ResourceBundle for which to get available locales, or empty string for default locales list http://php.net/manual/en/resourcebundle.locales.php

Public methods

Name Description
getCountries Get Countries list
getCountry Get Country
getRelativePrimaryLanguages Get languages list relative to its locale
getPrimaryLanguages Get languages list
getOrientation Get characters orientation, which is either 'ltr' (left-to-right) or 'rtl' (right-to-left)

Example

To get orientaion use the following code

<?= Yii::$app->locale->getOrientation() ?>

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-04-21