https://github.com/chinleung/verbose-localization
A package to allow your class to support verbose localization.
https://github.com/chinleung/verbose-localization
localization php verbose
Last synced: 3 months ago
JSON representation
A package to allow your class to support verbose localization.
- Host: GitHub
- URL: https://github.com/chinleung/verbose-localization
- Owner: chinleung
- License: mit
- Created: 2019-08-06T18:46:10.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-08-06T19:58:50.000Z (almost 6 years ago)
- Last Synced: 2025-03-18T14:35:21.161Z (4 months ago)
- Topics: localization, php, verbose
- Language: PHP
- Size: 25.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Verbose Localization
[](https://packagist.org/packages/chinleung/verbose-localization)
[](https://travis-ci.org/chinleung/verbose-localization)
[](https://scrutinizer-ci.com/g/chinleung/verbose-localization)
[](https://packagist.org/packages/chinleung/verbose-localization)A package to allow your class to support verbose localization.
## Installation
You can install the package via composer:
```bash
composer require chinleung/verbose-localization
```## Usage
Add the `ChinLeung\VerboseLocalization\HasVerboseLocalization` trait to your class and create a method `getTranslationIn(string $locale)` to handle the translation of your class and get access to all the verbose methods instantly like the following example.
Suppose you have files with the translation of the text equivalent of numbers:
``` php
value = $value;
}/**
* Retrieve the translation in a specific locale.
*
* @param string $locale
* @return string
*/
public function getTranslationIn(string $locale) : string
{
$translations = require __DIR__."/resources/lang/$locale/numbers.php";return $translations[$this->value];
}
}
```Then you can retrieve the translations like this:
```
$number = new NumberClass(1);$number->inFrench(); // 'un'
$number->inEnglish(); // 'one'
$number->inSimplifiedChinese(); // '一'
```## Methods
The methods are seperated by language families which are located in [src/Concerns](https://github.com/chinleung/verbose-localization/tree/master/src/Concerns).
### [Afro-Asiatic](https://github.com/chinleung/verbose-localization/tree/master/src/Concerns/HasAfroAsiaticVerboseMethods.php)
View Methods
* inAmharic
* inArabic
* inHausa
* inHebrew
* inMaltese
* inSomali### [Austronesian](https://github.com/chinleung/verbose-localization/tree/master/src/Concerns/HasAustronesianVerboseMethods.php)
View Methods
* inCebuano
* inFilipino
* inHawaiian
* inJavanese
* inKhmer
* inMalagasy
* inMalay### [Dravidian](https://github.com/chinleung/verbose-localization/tree/master/src/Concerns/HasDravidianVerboseMethods.php)
View Methods
* inKannada
* inMalayalam
* inTamil
* inTelugu### [French Creole](https://github.com/chinleung/verbose-localization/tree/master/src/Concerns/HasFrenchCreoleVerboseMethods.php)
View Methods
* inHaitianCreole
### [Hmong-Mien](https://github.com/chinleung/verbose-localization/tree/master/src/Concerns/HasHmongMienVerboseMethods.php)
View Methods
* inHmong
### [Indo-European](https://github.com/chinleung/verbose-localization/tree/master/src/Concerns/HasIndoEuropeanVerboseMethods.php)
View Methods
* inAlbanian
* inArmenian
* inGreek#### [Balto-Slavic](https://github.com/chinleung/verbose-localization/tree/master/src/Concerns/HasBaltoSlavicVerboseMethods.php)
View Methods
* inBelarusian
* inBosnian
* inBulgarian
* inCroatian
* inCzech
* inLatvian
* inLithuanian
* inMacedonian
* inPolish
* inRussian
* inSerbian
* inSlovak
* inSlovenian
* inUkrainian#### [Celtic](https://github.com/chinleung/verbose-localization/tree/master/src/Concerns/HasCelticVerboseMethods.php)
View Methods
* inIrish
* inScotsGaelic
* inWelsh#### [Germanic](https://github.com/chinleung/verbose-localization/tree/master/src/Concerns/HasGermanicVerboseMethods.php)
View Methods
* inAfrikaans
* inDanish
* inDutch
* inEnglish
* inFrisian
* inGerman
* inIcelandic
* inLuxembourgish
* inNorwegian
* inSwedish
* inYiddish#### [Indo-Iranian](https://github.com/chinleung/verbose-localization/tree/master/src/Concerns/HasIndoIranianVerboseMethods.php)
View Methods
* inBengali
* inGujarati
* inHindi
* inKurmanjiKurdish
* inMarathi
* inNepali
* inPashto
* inPersian
* inPunjabi
* inSindhi
* inSinhala
* inTajik
* inUrdu#### [Italic](https://github.com/chinleung/verbose-localization/tree/master/src/Concerns/HasItalicVerboseMethods.php)
View Methods
* inCatalan
* inCorsican
* inFrench
* inGalician
* inItalian
* inLatin
* inPortuguese
* inRomanian
* inSpanish### [Isolate](https://github.com/chinleung/verbose-localization/tree/master/src/Concerns/HasIsolateVerboseMethods.php)
View Methods
* inBasque
* inEsperanto### [Japonic](https://github.com/chinleung/verbose-localization/tree/master/src/Concerns/HasJaponicVerboseMethods.php)
View Methods
* inJapanese
### [Kartvelian](https://github.com/chinleung/verbose-localization/tree/master/src/Concerns/HasKartvelianVerboseMethods.php)
View Methods
* inGeorgian
### [Koreanic](https://github.com/chinleung/verbose-localization/tree/master/src/Concerns/HasKoreanicVerboseMethods.php)
View Methods
* inKorean
### [Kra-Dai](https://github.com/chinleung/verbose-localization/tree/master/src/Concerns/HasKraDaiVerboseMethods.php)
View Methods
* inLao
* inThai### [Monogolic](https://github.com/chinleung/verbose-localization/tree/master/src/Concerns/HasMonogolicVerboseMethods.php)
View Methods
* Mongolian
### [Niger-Congo](https://github.com/chinleung/verbose-localization/tree/master/src/Concerns/HasNigerCongoVerboseMethods.php)
View Methods
* inChewa
* inChichewa
* inIgbo
* inSesotho
* inShona
* inSwahili
* inXhosa
* inYoruba
* inZulu### [Sino-Tibetan](https://github.com/chinleung/verbose-localization/tree/master/src/Concerns/HasSinoTibetanVerboseMethods.php)
View Methods
* inBurmeseMyanmar
* inSimplifiedChinese
* inTraditionalChinese### [Turkic](https://github.com/chinleung/verbose-localization/tree/master/src/Concerns/HasTurkicVerboseMethods.php)
View Methods
* inAzerbaijani
* inKazakh
* inKyrgyz
* inTurkish
* inUzbek### [Uralic](https://github.com/chinleung/verbose-localization/tree/master/src/Concerns/HasUralicVerboseMethods.php)
View Methods
* inEstonian
* inFinnish
* inHungarian### Testing
``` bash
composer test
```### Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
### Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
## Credits
- [Chin Leung](https://github.com/chinleung)
- [All Contributors](../../contributors)## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
## PHP Package Boilerplate
This package was generated using the [PHP Package Boilerplate](https://laravelpackageboilerplate.com).