2017 © Pedro Peláez
 

library amalgama

PHPixie internationalization library

image

phpixie/amalgama

PHPixie internationalization library

  • Monday, November 24, 2014
  • by nxeed
  • Repository
  • 1 Watchers
  • 5 Stars
  • 87 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Internationalization Module for PHPixie

  • Simple to use
  • No lang param in url for default language
  • Params in translations
  • Auto routes modify

Setup

  • Define this package in "require" section of composer.json ``` json "phpixie/amalgama": "2.*@dev"
* Update packages
``` bash
php composer.phar update -o  --prefer-dist
  • Add a config file under /assets/config/amalgama.php ``` php return array( // The list of languages 'list' => array('en', 'ru', 'kk'), // Default language 'default' => 'en', // For using autorouting extension 'autorouting' => true, // Names of routes for except them from autorouting extension 'autoroutingExcept' => '^admin_' );
* Override your *Pixie.php*
``` php
namespace App;

class Pixie extends \PHPixie\Amalgama\Pixie {
  ...
  protected function after_bootstrap() {
    parent::after_bootstrap();
  }
}
  • Define module in your Pixie.php ``` php protected $modules = array( ... 'amalgama' => '\PHPixie\Amalgama' );
* Override your base controller
``` php
 array(
  array('(/)(/(/(/)))', array('lang' => '(en|ru)')
  array(
    'controller' => 'hello',
    'action' => 'index',
    'lang' => 'en'
  ),
),
```
* Add translation files under */assets/config/amalgama*
``` php
//ru.php
 'Привет мир!',
  'Hello >!' => 'Привет >!'
);
```
Usage
--------------------
``` php
// view example
</div>
!', array($user->name); ?>

``` php // lang switcher example helper->getLangList() as $lang) : ?> helper->getCurrentLang()) : ?> , (*1)

``` php
// Paginate example
...
$page = $this->request->param('page');

$comments = $this->pixie->orm->get('comment');
$pager = $this->pixie->paginate->orm($comments, $page, 10);
$pager->set_url_route('comments', array('lang' => $this->lang));
...

php // Validate example $validator->field('username') ->rule('filled') ->error($this->__('Field <?> must not be empty', array($this->__('username'))));, (*2)

The Versions

24/11 2014

2.1.x-dev

2.1.9999999.9999999-dev

PHPixie internationalization library

  Sources   Download

BSD

The Requires

 

i18n internationalization

24/11 2014

2.2.x-dev

2.2.9999999.9999999-dev

PHPixie internationalization library

  Sources   Download

BSD

The Requires

 

i18n internationalization

24/11 2014

dev-master

9999999-dev

PHPixie internationalization library

  Sources   Download

BSD

The Requires

 

i18n internationalization