Skip to content

Commit ad3d816

Browse files
authored
Prettier code examples in readme
1 parent c747deb commit ad3d816

1 file changed

Lines changed: 18 additions & 13 deletions

File tree

readme.md

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ Data can be returned as a lookup array or an array of key-value pairs, where bot
1818

1919
At the command line run
2020

21-
```
21+
```shell
2222
composer require petercoles/multilingual-language-list
2323
```
2424

2525
If you're using Laravel 5.5 or later (and haven't disabled package discovery), you're done. Move on to the usage section below.
2626

2727
If you're using an older version of Laravel, then add the service provider to the providers entry in your config/app.php file
2828

29-
```
29+
```php
3030
'providers' => [
3131
// ...
3232
PeterColes\Languages\LanguagesServiceProvider::class,
@@ -36,7 +36,7 @@ If you're using an older version of Laravel, then add the service provider to th
3636

3737
An optional facade is also available and can be enabled by adding the following to you config/app.php's aliases array
3838

39-
```
39+
```php
4040
'Languages' => PeterColes\Languages\LanguagesFacade::class,
4141
```
4242

@@ -55,7 +55,7 @@ The resulting collection will be cast to a json object by Laravel if returned as
5555

5656
#### Example: Default settigs
5757

58-
```
58+
```php
5959
Languages::lookup();
6060

6161
// returns
@@ -70,7 +70,7 @@ Languages::lookup();
7070

7171
#### Example: Limiting the languages displayed
7272

73-
```
73+
```php
7474
Languages::lookup(['en', 'fr', 'de']);
7575

7676
// returns
@@ -84,7 +84,7 @@ Languages::lookup(['en', 'fr', 'de']);
8484

8585
#### Example: Changing the display language
8686

87-
```
87+
```php
8888
Languages::lookup(['en', 'fr', 'de'], 'fr');
8989

9090
// returns
@@ -98,7 +98,7 @@ Languages::lookup(['en', 'fr', 'de'], 'fr');
9898

9999
#### Example: Reverse lookups
100100

101-
```
101+
```php
102102
Languages::lookup(['en', 'fr', 'de'], 'fr', true);
103103

104104
// returns
@@ -112,7 +112,8 @@ Languages::lookup(['en', 'fr', 'de'], 'fr', true);
112112
```
113113

114114
#### Example: Non-latin character sets are supported too
115-
```
115+
116+
```php
116117
Languages::lookup(['en', 'fr', 'de', 'bs'], 'bs_Cyrl');
117118

118119
// returns
@@ -135,7 +136,8 @@ The ```keyValue``` method takes four optional parameters:
135136
* $value - default "value"
136137

137138
#### Example: Default settings
138-
```
139+
140+
```php
139141
Languages::keyValue();
140142

141143
// returns
@@ -148,9 +150,10 @@ Languages::keyValue();
148150
{"key": "zu", "value": "Zulu"}
149151
]
150152
```
153+
151154
#### Example: Include "minor" languages
152155

153-
```
156+
```php
154157
Languages::keyValue('minor');
155158

156159
// returns
@@ -168,7 +171,7 @@ Languages::keyValue('minor');
168171

169172
#### Example: The kitchen sink - custom list, in non-Latin language with custom indices
170173

171-
```
174+
```php
172175
Languages::keyValue(['en', 'ja', 'zh'], 'zh', 'label', 'text');
173176

174177
// returns
@@ -187,7 +190,8 @@ Sometimes you might want to display a list of languages where each language is e
187190
By using the special "mixed" locale as the second parameter and a custom array as the first, the languages in that custom array will each be rendered in their own localised form, in the order given in the first parameter.
188191

189192
#### Example: lookup
190-
```
193+
194+
```php
191195
Languages::lookup(['en', 'fr', 'de', 'ja', 'ru', 'zh'], 'mixed');
192196

193197
// returns
@@ -204,7 +208,8 @@ Languages::lookup(['en', 'fr', 'de', 'ja', 'ru', 'zh'], 'mixed');
204208
```
205209

206210
#### Example: key-value
207-
```
211+
212+
```php
208213
Languages::keyValue(['en', 'fr', 'de', 'ja', 'ru', 'zh'], 'mixed');
209214

210215
// returns

0 commit comments

Comments
 (0)