Skip to content

Commit

Permalink
[docs]: Added information about laravel-lang/native-country-names p…
Browse files Browse the repository at this point in the history
…ackage
  • Loading branch information
andrey-helldar committed Nov 19, 2023
1 parent 789ef98 commit 7283b2f
Show file tree
Hide file tree
Showing 7 changed files with 227 additions and 5 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,49 +52,57 @@ jobs:
rm -rf docs/statuses/http-statuses
rm -rf docs/statuses/lang
rm -rf docs/statuses/native-locale-names
rm -rf docs/statuses/native-country-names
mkdir docs/statuses/attributes
mkdir docs/statuses/http-statuses
mkdir docs/statuses/lang
mkdir docs/statuses/native-locale-names
mkdir docs/statuses/native-country-names
- name: Download repositories
run: |
git clone --no-tags --single-branch https://github.com/Laravel-Lang/attributes.git tmp/attributes
git clone --no-tags --single-branch https://github.com/Laravel-Lang/http-statuses.git tmp/http-statuses
git clone --no-tags --single-branch https://github.com/Laravel-Lang/lang.git tmp/lang
git clone --no-tags --single-branch https://github.com/Laravel-Lang/native-locale-names.git tmp/native-locale-names
git clone --no-tags --single-branch https://github.com/Laravel-Lang/native-country-names.git tmp/native-country-names
- name: Move translation statuses
run: |
mv -f tmp/attributes/docs/status.md docs/statuses/attributes/index.md
mv -f tmp/http-statuses/docs/status.md docs/statuses/http-statuses/index.md
mv -f tmp/lang/docs/status.md docs/statuses/lang/index.md
mv -f tmp/native-locale-names/docs/status.md docs/statuses/native-locale-names/index.md
mv -f tmp/native-country-names/docs/status.md docs/statuses/native-country-names/index.md
mv -f tmp/attributes/docs/statuses docs/statuses/attributes/statuses
mv -f tmp/http-statuses/docs/statuses docs/statuses/http-statuses/statuses
mv -f tmp/lang/docs/statuses docs/statuses/lang/statuses
mv -f tmp/native-locale-names/docs/statuses docs/statuses/native-locale-names/statuses
mv -f tmp/native-country-names/docs/statuses docs/statuses/native-country-names/statuses
- name: Resolve page names
run: |
sed -i 's/# Completion Status/# Completion Status: Attributes/g' docs/statuses/attributes/index.md
sed -i 's/# Completion Status/# Completion Status: HTTP Statuses/g' docs/statuses/http-statuses/index.md
sed -i 's/# Completion Status/# Completion Status: Lang/g' docs/statuses/lang/index.md
sed -i 's/# Completion Status/# Completion Status: Native Locale Names/g' docs/statuses/native-locale-names/index.md
sed -i 's/# Completion Status/# Completion Status: Native Locale Names/g' docs/statuses/native-country-names/index.md
- name: Resolve navigation links
run: |
sed -i 's/<\/table>/<\/table>\n\n[ [go back](..\/index.md) | [to top](\#) ]/g' docs/statuses/attributes/index.md
sed -i 's/<\/table>/<\/table>\n\n[ [go back](..\/index.md) | [to top](\#) ]/g' docs/statuses/http-statuses/index.md
sed -i 's/<\/table>/<\/table>\n\n[ [go back](..\/index.md) | [to top](\#) ]/g' docs/statuses/lang/index.md
sed -i 's/<\/table>/<\/table>\n\n[ [go back](..\/index.md) | [to top](\#) ]/g' docs/statuses/native-locale-names/index.md
sed -i 's/<\/table>/<\/table>\n\n[ [go back](..\/index.md) | [to top](\#) ]/g' docs/statuses/native-country-names/index.md
sed -i 's/..\/status.md/..\/index.md/g' docs/statuses/attributes/statuses/*
sed -i 's/..\/status.md/..\/index.md/g' docs/statuses/http-statuses/statuses/*
sed -i 's/..\/status.md/..\/index.md/g' docs/statuses/lang/statuses/*
sed -i 's/..\/status.md/..\/index.md/g' docs/statuses/native-locale-names/statuses/*
sed -i 's/..\/status.md/..\/index.md/g' docs/statuses/native-country-names/statuses/*
- name: Build VuePress site
run: npm run build
Expand Down
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,14 @@
"laravel-lang/attributes": "^2.5.0",
"laravel-lang/http-statuses": "^3.5.0",
"laravel-lang/lang": "^13.3.0",
"laravel-lang/locale-list": "^1.0",
"laravel-lang/locales": "^1.9",
"laravel-lang/native-country-names": "^1.0",
"laravel-lang/native-locale-names": "^1.4",
"laravel-lang/publisher": "^15.0"
},
"require-dev": {
"dragon-code/support": "^6.11",
"laravel-lang/locale-list": "^1.0.1",
"orchestra/testbench": "^8.14",
"phpunit/phpunit": "^10.4.2",
"symfony/var-dumper": "^6.3.6"
Expand Down
2 changes: 2 additions & 0 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ module.exports = {
{text: 'Attributes', link: '/statuses/attributes/index.md'},
{text: 'HTTP Statuses', link: '/statuses/http-statuses/index.md'},
{text: 'Native Locale Names', link: '/statuses/native-locale-names/index.md'},
{text: 'Native Country Names', link: '/statuses/native-country-names/index.md'},
]
},
],
Expand Down Expand Up @@ -139,6 +140,7 @@ module.exports = {
'/usage/features/facades.md',
'/usage/features/locale-list.md',
'/usage/features/native-locale-names.md',
'/usage/features/native-country-names.md',
'/usage/features/alignment.md',
'/usage/features/smart-punctuation.md',
]
Expand Down
8 changes: 7 additions & 1 deletion docs/installation/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,13 @@ This package solves this problem.

## `laravel-lang/native-locale-names`

This package contains a list of localized language names.
This package contains a list of localized locale names.

I think there is no need to explain why it can be useful 🙂

## `laravel-lang/native-country-names`

This package contains a list of localized country names.

I think there is no need to explain why it can be useful 🙂

Expand Down
12 changes: 10 additions & 2 deletions docs/installation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,21 @@ php artisan lang:update

## Recommended

To get the latest version of `Laravel Lang: Common`, simply require the project using [Composer](https://getcomposer.org):
To get the latest version of `Laravel Lang: Common`, simply require the project
using [Composer](https://getcomposer.org):

```bash:no-line-numbers
composer require --dev laravel-lang/common
```

::: tip
If you are using the list of localizations from the `Laravel Lang: Publisher` package in production, then use this command instead: `composer require laravel-lang/common`.
If you need a list of locales in production, separately install the `laravel-lang/locales` dependency by calling the
console command:

```bash:no-line-numbers
composer require laravel-lang/locales
```

:::

Now you can manage localizations:
Expand All @@ -43,4 +50,5 @@ composer require --dev laravel-lang/http-statuses
composer require laravel-lang/locales
composer require laravel-lang/locale-list
composer require laravel-lang/native-locale-names
composer require laravel-lang/native-country-names
```
196 changes: 196 additions & 0 deletions docs/usage/features/native-country-names.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
# Native Country Names

If you want to get a localized list of countries, then simply call the `Native::get()` method from
the [`laravel-lang/native-country-names`](../../installation/index.md#installation) package.

## Localized Names

```php
use LaravelLang\NativeCountryNames\Native;
use LaravelLang\LocaleList\Locale;

return Native::get('bn');
// or
return Native::get(Locale::Bengali)
```

Result:

```php
array:79 [
"is" => "আইসল্যান্ড"
"az" => "আজারবাইজান"
"ps" => "আফগানিস্তান"
"hy" => "আর্মেনিয়া"
"sq" => "আলবেনিয়া"
"uk" => "ইউক্রেন"
"he" => "ইজরায়েল"
"it" => "ইতালি"
"sc" => "ইতালি"
"id" => "ইন্দোনেশিয়া"
"fa" => "ইরান"
// ...
]
```

## 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\NativeCountryNames\Native;

return Native::get();
// or
return Native::get('');
// or
return Native::get(null);
// or
return Native::get('foo');
```

Result:

```php
array:79 [
"az" => "Azərbaycan"
"bs" => "Bosna I Hercegovina"
"pt" => "Brasil"
"pt_BR" => "Brasil"
"sr_Latn_ME" => "Crna Gora"
"da" => "Danmark"
"de" => "Deutschland"
"et" => "Eesti"
"eu" => "Espainia"
"ca" => "Espanya"
"es" => "España"
"gl" => "España"
"oc" => "Fr"
"fr" => "France"
"hr" => "Hrvatska"
"id" => "Indonesia"
"it" => "Italia"
"sc" => "Itàlia"
"lv" => "Latvija"
"lt" => "Lietuva"
"hu" => "Magyarország"
"ms" => "Malaysia"
"nl" => "Nederland"
"nn" => "Noreg"
"nb" => "Norge"
"uz_Latn" => "Oʻzbekiston"
"tl" => "Philippines"
"fil" => "Pilipinas"
"pl" => "Polska"
"ro" => "România"
"de_CH" => "Schweiz"
"sq" => "Shqipëri"
"sl" => "Slovenija"
"sk" => "Slovensko"
"sr_Latn" => "Srbija"
"af" => "Suid-Afrika"
"fi" => "Suomi"
"sv" => "Sverige"
"sw" => "Tanzania"
"tr" => "Türkiye"
"tk" => "Türkmenistan"
"en" => "United States"
"vi" => "Việt Nam"
"cy" => "Y Deyrnas Unedig"
"is" => "Ísland"
"cs" => "Česko"
"el" => "Ελλάδα"
"uz_Cyrl" => "Ўзбекистон"
"be" => "Беларусь"
"bg" => "България"
"mn" => "Монгол"
"ru" => "Россия"
"mk" => "Северна Македонија"
"sr_Cyrl" => "Србија"
"tg" => "Тоҷикистон"
"uk" => "Україна"
"kk" => "Қазақстан"
"hy" => "Հայաստան"
"he" => "ישראל"
"ps" => "افغانستان"
"fa" => "ایران"
"ug" => "جۇڭگو"
"ar" => "مصر"
"ur" => "پاکستان"
"ne" => "नेपाल"
"hi" => "भारत"
"mr" => "भारत"
"bn" => "বাংলাদেশ"
"gu" => "ભારત"
"kn" => "ಭಾರತ"
"si" => "ශ්\u{200D}රී ලංකාව"
"th" => "ไทย"
"ka" => "საქართველო"
"km" => "កម្ពុជា"
"zh_CN" => "中国"
"zh_HK" => "中国香港特别行政区"
"zh_TW" => "台湾"
"ja" => "日本"
"ko" => "대한민국"
]
```

## 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\NativeCountryNames\Native;
use LaravelLang\NativeCountryNames\Enums\SortBy;

return Native::get('en', SortBy::Key);
```

Result:

```php
array:79 [
"af" => "South Africa"
"ar" => "Egypt"
"az" => "Azerbaijan"
"be" => "Belarus"
"bg" => "Bulgaria"
"bn" => "Bangladesh"
"bs" => "Bosnia & Herzegovina"
"ca" => "Spain"
"cs" => "Czechia"
// ...
]
```

### Sort By Values

```php
use LaravelLang\NativeCountryNames\Native;
use LaravelLang\NativeCountryNames\Enums\SortBy;

return Native::get('en', SortBy::Value);
// or
return Native::get('en');
```

Result:

```php
array:79 [
"ps" => "Afghanistan"
"sq" => "Albania"
"hy" => "Armenia"
"az" => "Azerbaijan"
"bn" => "Bangladesh"
"be" => "Belarus"
"bs" => "Bosnia & Herzegovina"
"pt" => "Brazil"
// ...
]
```
2 changes: 1 addition & 1 deletion docs/usage/features/native-locale-names.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Native Locale Names

If you want to get a localized list of languages, then simply call the `Native::get()` method from
the [`laravel-lang/native-locale-names`](../../installation/index.md) package.
the [`laravel-lang/native-locale-names`](../../installation/index.md#alternative) package.

## Localized Names

Expand Down

0 comments on commit 7283b2f

Please sign in to comment.