dynamix/i18n

此包已被弃用且不再维护。未建议替代包。
此包最新版本(v1.2.25)没有提供许可证信息。

DynamixCMS的国际化组件

v1.2.25 2017-02-13 14:55 UTC

README

此包将为80个地区提供国际化支持。

I18n API

I18n::add

// Your data structure
$data = array('en' => 'helloworld', 'fr' => 'bonjour');

// Type of translation (required!)
$type = 'title';

// The i18n key is used with the `App::locale()` value.
$key = 'groupname.keyname';

// Ready ! 
I18n::add($data, $type, $key = null);

I18n::read

// Get your i18n id !
$id = 1;

// Read it
$i18n = I18n::read($id);

// Read it 
$i18n['en'] // = 'helloworld';

I18n::change

// Get your i18n id !
$id = 1;

// Make your datas
$data = array('en' => 'goodbye', 'fr' => 'aurevoir');

// Edit it
I18n::change($id, $data);

I18n::remove

// Get your i18n id !
$id = 1;

// Remove it
I18n::remove($id);

I18n::get

// Get your i18n id !
$key = 'groupname.keyname';

// Remove it
I18n::get($key);

I18n::getTranslation

// Get Translation
I18n::getTranslation($i18n_id, $locale = App::getLocale());

Locale API

Locale::getFrontEnabled

// Get Front Enabled Locale
Locale::getFrontEnabled();// array of Locale object

MomentJS

如果你需要在应用中使用momentjs,只需将这些行添加到复制dist/momentjs仓库到你的public路径

GruntJS

copy: {
	files: [
		// MomentJS
		{expand: true, cwd: './../../../workbench/dynamix/i18n/dist/momentjs/', src: ['**'], dest: './../../../public/momentjs/'}
	]
},

BrunchJS

plugins
  assetsmanager:
    copyTo:
      '../../../' : ['../../../../workbench/dynamix/i18n/dist/momentjs','../../../../vendor/dynamix/i18n/dist/momentjs']