@trenskow/language 1.2.4 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,23 +27,23 @@ Takes a (partially) full RFC 5646 string and reduces it to its minimum value.
|
|
|
27
27
|
### Example
|
|
28
28
|
|
|
29
29
|
```javascript
|
|
30
|
-
collapse('da-Latn-DK'); //
|
|
31
|
-
collapse('da-DK') //
|
|
32
|
-
collapse('en-US') //
|
|
30
|
+
collapse('da-Latn-DK'); // -> 'da'
|
|
31
|
+
collapse('da-DK') // -> 'da'
|
|
32
|
+
collapse('en-US') // -> 'en-US'
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
## `match(identifier, supported, [default])`
|
|
36
36
|
|
|
37
|
-
Takes an HTTP `Accept-Header` value
|
|
37
|
+
Takes an HTTP `Accept-Header` value and returns the language to use based on an array of supported languages.
|
|
38
38
|
|
|
39
39
|
> If `default` is omitted the first supported language becomes the default.
|
|
40
40
|
|
|
41
41
|
### Example
|
|
42
42
|
|
|
43
43
|
```javascript
|
|
44
|
-
match('da, en-US; en-GB;q=0.8, en', ['da', 'en-US'], 'en-US'); //
|
|
45
|
-
match('en-GB;q=0.8, en', ['en-US', 'da-DK']); //
|
|
46
|
-
match('de-DE', ['da-DK', 'en-US'], 'en-US'); //
|
|
44
|
+
match('da, en-US; en-GB;q=0.8, en', ['da', 'en-US'], 'en-US'); // -> 'da'
|
|
45
|
+
match('en-GB;q=0.8, en', ['en-US', 'da-DK']); // -> 'en-US'
|
|
46
|
+
match('de-DE', ['da-DK', 'en-US'], 'en-US'); // -> 'en-US'
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
## `all`
|
|
@@ -53,8 +53,7 @@ Returns all posible identifier combinations.
|
|
|
53
53
|
### Example
|
|
54
54
|
|
|
55
55
|
```javascript
|
|
56
|
-
all /*
|
|
57
|
-
[
|
|
56
|
+
all /* -> [
|
|
58
57
|
'af-Latn-NA', 'af-NA', 'af-Latn-ZA', 'af-ZA', 'am-Ethi-ET',
|
|
59
58
|
'am-ET', 'am', 'ar-Arab-AE', 'ar-Arab-BH', 'ar-Arab-DJ',
|
|
60
59
|
'ar-Arab-DZ', 'ar-Arab-EG', 'ar-Arab-EH', 'ar-Arab-ER', 'ar-Arab-IL',
|