This repository has been archived by the owner on Jan 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from EtienneLamoureux/1.2.0
1.2.0
- Loading branch information
Showing
10 changed files
with
130 additions
and
10 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
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
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
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
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
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,43 @@ | ||
Utilities | ||
=== | ||
Utilities are miscellaneous functionalities provided by Durmand Scriptorium to get the most out of the Guild Wars 2 API. | ||
|
||
Localization | ||
--- | ||
### Definition | ||
```php | ||
public function setLocale($localeCode) | ||
``` | ||
|
||
The localization utilities populate the information coming from the API with strings translated in the specified locale. The default locale is English. For a complete list of the supported ISO 639-1 codes to pass to this function, see *Crystalgorithm\DurmandScriptorium\utils\Locale*. | ||
|
||
### Supported locales | ||
- English | ||
- Español | ||
- Deutsch | ||
- Français | ||
- 한국어 (Hangugeo) | ||
- 中文 (Zhōngwén) | ||
|
||
### Example | ||
```php | ||
<?php | ||
|
||
use Crystalgorithm\DurmandScriptorium\Facade as DurmandScriptorium; | ||
use Crystalgorithm\DurmandScriptorium\utils\Locale; | ||
|
||
require 'vendor/autoload.php'; | ||
|
||
// Setup initial locale to use for all API calls | ||
// Those two lines are equivalent | ||
$api = new DurmandScriptorium(Locale::FRENCH); | ||
$api = new DurmandScriptorium('fr'); // ISO 639-1 code | ||
|
||
// You can also change the locale on the fly | ||
// Again, both these lines are equivalent | ||
$api->setLocale(Locale::GERMAN); | ||
$api->setLocale('de'); // ISO 639-1 code | ||
``` | ||
###Throws | ||
*UnexpectedValueException* if given an unsupported locale code | ||
|
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
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,48 @@ | ||
<?php | ||
|
||
/* | ||
* @author Etienne Lamoureux <etienne.lamoureux@crystalgorithm.com> | ||
* @copyright 2014 Etienne Lamoureux | ||
* @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause | ||
*/ | ||
namespace Crystalgorithm\DurmandScriptorium\utils; | ||
|
||
use MyCLabs\Enum\Enum; | ||
|
||
/** | ||
* ISO 639-1 locales supported by the GW2 API | ||
*/ | ||
class Locale extends Enum | ||
{ | ||
|
||
/** | ||
* English | ||
*/ | ||
const ENGLISH = 'en'; | ||
|
||
/** | ||
* Español | ||
*/ | ||
const SPANISH = 'es'; | ||
|
||
/** | ||
* Deutsch | ||
*/ | ||
const GERMAN = 'de'; | ||
|
||
/** | ||
* Français | ||
*/ | ||
const FRENCH = 'fr'; | ||
|
||
/** | ||
* 한국어 (Hangugeo) | ||
*/ | ||
const KOREAN = 'ko'; | ||
|
||
/** | ||
* 中文; Zhōngwén | ||
*/ | ||
const CHINESE = 'zh'; | ||
|
||
} |
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
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