-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Stefano Azzolini
committed
Feb 1, 2016
0 parents
commit 6c27612
Showing
4 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.DS_Store | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
Core – Translation Extensions | ||
==== | ||
|
||
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/caffeina-core/translation/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/caffeina-core/translation/?branch=master) | ||
[![Build Status](https://scrutinizer-ci.com/g/caffeina-core/translation/badges/build.png?b=master)](https://scrutinizer-ci.com/g/caffeina-core/translation/build-status/master) | ||
[![Total Downloads](https://poser.pugx.org/caffeina-core/translation/downloads.svg)](https://packagist.org/packages/caffeina-core/translation) | ||
[![Latest Stable Version](https://poser.pugx.org/caffeina-core/translation/v/stable.svg)](https://packagist.org/packages/caffeina-core/translation) | ||
[![Latest Unstable Version](https://poser.pugx.org/caffeina-core/translation/v/unstable.svg)](https://packagist.org/packages/caffeina-core/translation) | ||
[![License](https://poser.pugx.org/caffeina-core/translation/license.svg)](https://packagist.org/packages/caffeina-core/translation) | ||
|
||
|
||
## Installation | ||
|
||
Install via [composer](https://getcomposer.org/download/): | ||
|
||
```bash | ||
$ composer require caffeina-core/translation | ||
``` | ||
|
||
## Documentation | ||
|
||
See the [wiki](https://github.com/caffeina-core/translation/wiki). | ||
|
||
|
||
## Contributing | ||
|
||
How to get involved: | ||
|
||
1. [Star](https://github.com/caffeina-core/api/stargazers) the project! | ||
2. Answer questions that come through [GitHub issues](https://github.com/caffeina-core/translation/issues?state=open) | ||
3. [Report a bug](https://github.com/caffeina-core/translation/issues/new) that you find | ||
|
||
|
||
Core follows the [GitFlow branching model](http://nvie.com/posts/a-successful-git-branching-model). The ```master``` branch always reflects a production-ready state while the latest development is taking place in the ```develop``` branch. | ||
|
||
Each time you want to work on a fix or a new feature, create a new branch based on the ```develop``` branch: ```git checkout -b BRANCH_NAME develop```. Only pull requests to the ```develop``` branch will be merged. | ||
|
||
Pull requests are **highly appreciated**. | ||
|
||
Solve a problem. Features are great, but even better is cleaning-up and fixing issues in the code that you discover. | ||
|
||
## Versioning | ||
|
||
Core is maintained by using the [Semantic Versioning Specification (SemVer)](http://semver.org). | ||
|
||
|
||
## Copyright and license | ||
|
||
Copyright 20145 [Caffeina](http://caffeina.co) srl under the [MIT license](LICENSE.md). | ||
|
||
<p align="center"><a href="http://caffeina.co" target="_blank" title="Caffeina - Ideas Never Sleep"><img src="https://github.com/CaffeinaLab/BrandResources/blob/master/caffeina-handmade.png?raw=true" align="center" height="65"></a></p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
/** | ||
* Language | ||
* | ||
* Localization tools. | ||
* | ||
* @package core | ||
* @author [email protected] | ||
* @version 0.1 * @copyright Caffeina srl - 2015 - http://caffeina.it | ||
*/ | ||
|
||
class Language extends Dictionary { | ||
use Module; | ||
protected static $current_lang = 'en'; | ||
|
||
public static function translate($text,$params=null){ | ||
$result = static::get(static::$current_lang.'.'.strtolower($text),$text); | ||
return $params ? Text::render($result) : $result; | ||
} | ||
|
||
public static function using($lang){ | ||
static::$current_lang = strtolower(trim($lang)); | ||
} | ||
|
||
public static function load($lang, $dictfile){ | ||
ob_start(); $lang = include($dictfile); ob_end_clean(); | ||
static::merge([$lang => $dictfile]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "caffeina-core/translation", | ||
"type": "core-bundle", | ||
"description": "Translation extensions for Caffeina Core", | ||
"keywords": ["core","translation","language"], | ||
"homepage": "http://labs.caffeina.co/tech/core", | ||
"version": "1.0.0", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Stefano Azzolini", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"php": ">=5.4", | ||
"caffeina-core/core": "*" | ||
}, | ||
"minimum-stability": "stable", | ||
"autoload": { | ||
"classmap": [ "classes/" ] | ||
} | ||
} | ||
|