-
-
Notifications
You must be signed in to change notification settings - Fork 10
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 #148 from Laravel-Lang/5.x
[docs]: Added information about `laravel-lang/native-currency-names` package
- Loading branch information
Showing
7 changed files
with
225 additions
and
1 deletion.
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
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,207 @@ | ||
# Native Currency Names | ||
|
||
If you want to get a localized list of currencies, then simply call the `Native::get()` method from | ||
the [`laravel-lang/native-currency-names`](../../installation/index.md#alternative) package. | ||
|
||
## Localized Names | ||
|
||
```php | ||
use LaravelLang\NativeCurrencyNames\Native; | ||
use LaravelLang\LocaleList\Locale; | ||
|
||
return Native::get('bn'); | ||
// or | ||
return Native::get(Locale::Bengali) | ||
``` | ||
|
||
Result: | ||
|
||
```php | ||
array:79 [ | ||
0 => LaravelLang\NativeCurrencyNames\Data\CurrencyData { | ||
+locale: "af" | ||
+country: "ZA" | ||
+code: "ZAR" | ||
+numeric: 710 | ||
+name: "South African Rand" | ||
+native: "Suid-Afrikaanse rand" | ||
+localized: "দক্ষিণ আফ্রিকান রেন্ড" | ||
} | ||
1 => LaravelLang\NativeCurrencyNames\Data\CurrencyData { | ||
+locale: "sq" | ||
+country: "AL" | ||
+code: "ALL" | ||
+numeric: 8 | ||
+name: "Albanian Lek" | ||
+native: "Leku shqiptar" | ||
+localized: "আলবেনিয়ান লেক" | ||
} | ||
2 => LaravelLang\NativeCurrencyNames\Data\CurrencyData { | ||
+locale: "ar" | ||
+country: "EG" | ||
+code: "EGP" | ||
+numeric: 818 | ||
+name: "Egyptian Pound" | ||
+native: "جنيه مصري" | ||
+localized: "মিশরীয় পাউন্ড" | ||
} | ||
// ... | ||
] | ||
``` | ||
|
||
## Native Names | ||
|
||
You can also get a list of localized names if you call the `get` method without passing parameters. | ||
The same thing will happen if you pass an incorrect or empty value to the parameter. | ||
|
||
```php | ||
use LaravelLang\NativeCurrencyNames\Native; | ||
|
||
return Native::get(); | ||
// or | ||
return Native::get(''); | ||
// or | ||
return Native::get(null); | ||
// or | ||
return Native::get('foo'); | ||
``` | ||
|
||
Result: | ||
|
||
```php | ||
array:79 [ | ||
0 => LaravelLang\NativeCurrencyNames\Data\CurrencyData { | ||
+locale: "af" | ||
+country: "ZA" | ||
+code: "ZAR" | ||
+numeric: 710 | ||
+name: "South African Rand" | ||
+native: "Suid-Afrikaanse rand" | ||
+localized: "Suid-Afrikaanse rand" | ||
} | ||
1 => LaravelLang\NativeCurrencyNames\Data\CurrencyData { | ||
+locale: "sq" | ||
+country: "AL" | ||
+code: "ALL" | ||
+numeric: 8 | ||
+name: "Albanian Lek" | ||
+native: "Leku shqiptar" | ||
+localized: "Leku shqiptar" | ||
} | ||
2 => LaravelLang\NativeCurrencyNames\Data\CurrencyData { | ||
+locale: "ar" | ||
+country: "EG" | ||
+code: "EGP" | ||
+numeric: 818 | ||
+name: "Egyptian Pound" | ||
+native: "جنيه مصري" | ||
+localized: "جنيه مصري" | ||
} | ||
// ... | ||
] | ||
``` | ||
|
||
## Sorting | ||
|
||
To get the result sorted by key or value, pass `SortBy` to the enum parameter. | ||
|
||
By default, sorting by values is applied. | ||
|
||
### Sort By Keys | ||
|
||
```php | ||
use LaravelLang\NativeCurrencyNames\Native; | ||
use LaravelLang\NativeCurrencyNames\Enums\SortByy; | ||
|
||
return Native::get('en', SortBy::Key); | ||
``` | ||
|
||
Result: | ||
|
||
```php | ||
array:79 [ | ||
0 => LaravelLang\NativeCurrencyNames\Data\CurrencyData { | ||
+locale: "af" | ||
+country: "ZA" | ||
+code: "ZAR" | ||
+numeric: 710 | ||
+name: "South African Rand" | ||
+native: "Suid-Afrikaanse rand" | ||
+localized: "South African Rand" | ||
} | ||
1 => LaravelLang\NativeCurrencyNames\Data\CurrencyData { | ||
+locale: "ar" | ||
+country: "EG" | ||
+code: "EGP" | ||
+numeric: 818 | ||
+name: "Egyptian Pound" | ||
+native: "جنيه مصري" | ||
+localized: "Egyptian Pound" | ||
} | ||
2 => LaravelLang\NativeCurrencyNames\Data\CurrencyData { | ||
+locale: "az" | ||
+country: "AZ" | ||
+code: "AZN" | ||
+numeric: 944 | ||
+name: "Azerbaijani Manat" | ||
+native: "Azərbaycan Manatı" | ||
+localized: "Azerbaijani Manat" | ||
} | ||
// ... | ||
] | ||
``` | ||
|
||
### Sort By Values | ||
|
||
```php | ||
use LaravelLang\NativeCurrencyNames\Native; | ||
use LaravelLang\NativeCurrencyNames\Enums\SortByy; | ||
|
||
return Native::get('en', SortBy::Value); | ||
// or | ||
return Native::get('en'); | ||
``` | ||
|
||
Result: | ||
|
||
```php | ||
array:79 [ | ||
0 => LaravelLang\NativeCurrencyNames\Data\CurrencyData { | ||
+locale: "af" | ||
+country: "ZA" | ||
+code: "ZAR" | ||
+numeric: 710 | ||
+name: "South African Rand" | ||
+native: "Suid-Afrikaanse rand" | ||
+localized: "South African Rand" | ||
} | ||
1 => LaravelLang\NativeCurrencyNames\Data\CurrencyData { | ||
+locale: "sq" | ||
+country: "AL" | ||
+code: "ALL" | ||
+numeric: 8 | ||
+name: "Albanian Lek" | ||
+native: "Leku shqiptar" | ||
+localized: "Albanian Lek" | ||
} | ||
2 => LaravelLang\NativeCurrencyNames\Data\CurrencyData { | ||
+locale: "ar" | ||
+country: "EG" | ||
+code: "EGP" | ||
+numeric: 818 | ||
+name: "Egyptian Pound" | ||
+native: "جنيه مصري" | ||
+localized: "Egyptian Pound" | ||
} | ||
3 => LaravelLang\NativeCurrencyNames\Data\CurrencyData { | ||
+locale: "hy" | ||
+country: "AM" | ||
+code: "AMD" | ||
+numeric: 51 | ||
+name: "Armenian Dram" | ||
+native: "հայկական դրամ" | ||
+localized: "Armenian Dram" | ||
} | ||
// ... | ||
] | ||
``` |