Giter Site home page Giter Site logo

yii2-multilanguage's Introduction

Yii2 MultiLanguage

License Latest Stable Version Latest Release Date Latest Commit Total Downloads

Multi Language support for Yii2 Framework based on this post on Official Forum:
http://www.yiiframework.com/forum/index.php/topic/56027-yii2-multilingual-website-url-rules/

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require cinghie/yii2-multilanguage "*"

or add this line to the require section of your composer.json file.

"cinghie/yii2-multilanguage": "*"

Configuration

Set in Configuration File:

// Language Settings
'language'   => 'en',
'sourceLanguage' => 'en_GB',

Make sure you have set the parameter 'language': the default language will be that

Set URL Manager in 'component' Configuration File:

// Url Manager
'urlManager' => [
    'class' => 'codemix\localeurls\UrlManager',
    'languages' => ['en', 'it', 'fr', 'de', 'es'], // List all supported languages here
    'enablePrettyUrl' => true,
    'showScriptName' => false,
],

Images

Copy the img folder from the project root to your web folders to see flag's images

Widgets

You can load the MultiLanguage Widget in the your view like this:

<?= MultiLanguageWidget::widget([
	'addCurrentLang' => true, // add current lang
	'calling_controller' => $this->context,
	'image_type'  => 'classic', // classic or rounded
	'link_home'   => true, // true or false
	'widget_type' => 'classic', // classic or selector
	'width'       => '28'
]); ?>

There are 4 params in the Widget:

  • Widget Type can be classic or selector
  • Image Type can be classic or rounded
  • Width in pixel of the flags
  • The Calling Controller (Do not Edit)

Changelog

  • Version 2.0.2 - Adding options to add current Lang on widgets
  • Version 2.0.1 - Adding Ca, Ch, In, Ne, Ru, Us flags
  • Version 2.0.0 - Refactoring project adding Yii2 Locale URLs: https://github.com/codemix/yii2-localeurls
  • Version 1.2.0 - Minor improvements
  • Version 1.1.2 - Fixing error to extends yii Widget problem
  • Version 1.1.1 - Update Copyright and license
  • Version 1.1.0 - Bug Fixed not home View
  • Version 1.0.0 - Initial Release

yii2-multilanguage's People

Contributors

cinghie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.