nva-language 1.0.9 → 1.0.10
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 +58 -43
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# nva
|
|
1
|
+
# nva-language-js
|
|
2
2
|
Javascript implementation of NVA (the Norwegian national research archive) language handling.
|
|
3
3
|
|
|
4
4
|
Languages in NVA are represented by URIs, this module allows users to find the correct URI for a language and find a name string in a given language for each URI without dereferencing the URI.
|
|
5
5
|
|
|
6
|
-
NVA
|
|
6
|
+
NVA-language also routes non-preferred representations to preferred representations.
|
|
7
7
|
|
|
8
8
|
## Using the library
|
|
9
9
|
|
|
@@ -46,10 +46,10 @@ All functions return a language object, which has the structure:
|
|
|
46
46
|
|
|
47
47
|
The properties are structured as follows:
|
|
48
48
|
|
|
49
|
-
- uri: a Lexvo ISO 639
|
|
50
|
-
- iso6391Code: an ISO 639
|
|
51
|
-
- iso6392Codes: an array containing ISO 639
|
|
52
|
-
- iso6393Code: an ISO 639
|
|
49
|
+
- uri: a Lexvo ISO 639-3 uri
|
|
50
|
+
- iso6391Code: an ISO 639-1, two-letter code
|
|
51
|
+
- iso6392Codes: an array containing ISO 639-2 B/T three\letter codes (min one, max. two items)
|
|
52
|
+
- iso6393Code: an ISO 639-3 code
|
|
53
53
|
- eng: the English name of the language
|
|
54
54
|
- nob: the Norwegian Bokmål name of the language
|
|
55
55
|
- nno: the Norwegian Nynorsk name of the language
|
|
@@ -57,42 +57,57 @@ The properties are structured as follows:
|
|
|
57
57
|
|
|
58
58
|
## Available functions
|
|
59
59
|
|
|
60
|
-
There are a number of methods provided by nva
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
60
|
+
There are a number of methods provided by nva-language, all of which return a Language object, these have self-explanatory names:
|
|
61
|
+
|
|
62
|
+
### getLanguageByBokmaalName
|
|
63
|
+
|
|
64
|
+
- example: `const english = getLanguageByBokmaalName('Engelsk')`
|
|
65
|
+
- Given a Norwegian Bokmål token for a language, say "Engelsk", returns a Language object that either matches the token, or is the Undefined language
|
|
66
|
+
- Matching is not case sensitive
|
|
67
|
+
|
|
68
|
+
### getLanguageByEnglishName
|
|
69
|
+
|
|
70
|
+
- example: `const english = getLanguageByEnglishName('English')`
|
|
71
|
+
- Given a Norwegian Bokmål token for a language, say "English", returns a Language object that either matches the token, or is the Undefined language
|
|
72
|
+
- Matching is not case sensitive
|
|
73
|
+
|
|
74
|
+
### getLanguageByIso6391Code
|
|
75
|
+
|
|
76
|
+
- example: `const english = getLanguageByIso6391Code('en')`
|
|
77
|
+
- Given an ISO 639-1 code, returns a Language object that either matches the token, or is the Undefined language
|
|
78
|
+
- Matching is not case sensitive
|
|
79
|
+
|
|
80
|
+
### getLanguageByIso6392Code
|
|
81
|
+
|
|
82
|
+
- example: `const english = getLanguageByIso6392Code('eng')`
|
|
83
|
+
- Given an ISO 639-2 code, returns a Language object that either matches the token, or is the Undefined language
|
|
84
|
+
- Returns e.g. a Language object for German if either the B/T ("ger", "deu") variants are supplied
|
|
85
|
+
- Matching is not case sensitive
|
|
86
|
+
|
|
87
|
+
### getLanguageByIso6393Code
|
|
88
|
+
|
|
89
|
+
- example: `const english = getLanguageByIso6393Code('eng')`
|
|
90
|
+
- Given an ISO 639-1 code, returns a Language object that either matches the token, or is the Undefined language
|
|
91
|
+
- Matching is not case sensitive
|
|
92
|
+
|
|
93
|
+
### getLanguageByNynorskName
|
|
94
|
+
|
|
95
|
+
- example: `const english = getLanguageByNynorskName('Engelsk')`
|
|
96
|
+
- Given a Norwegian Nynorsk token for a language, say "Engelsk", returns a Language object that either matches the token, or is the Undefined language
|
|
97
|
+
- Matching is not case sensitive
|
|
98
|
+
- The only difference between getLanguageByNynorskName and getLanguageByBokmaalName is Bokmål "Flere språk", Nynorsk "Fleire språk"
|
|
99
|
+
|
|
100
|
+
### getLanguageBySamiName
|
|
101
|
+
|
|
102
|
+
- example: `const english = getLanguageBySamiName('Eaŋgalsgiella')`
|
|
103
|
+
- Given a Northern Sami token for a language, say "Eaŋgalsgiella", returns a Language object that either matches the token, or is the Undefined language
|
|
104
|
+
- Matching is not case sensitive
|
|
105
|
+
|
|
106
|
+
## getLanguageByUri
|
|
107
|
+
|
|
108
|
+
- example: `const english = getLanguageByUri(' http://lexvo.org/id/iso639-3/eng')`
|
|
109
|
+
- Given a Lexvo ISO 639-3 URI, returns the corresponding language object or Undefined language (in the case that the URI is not in use)
|
|
110
|
+
- Note: Lexvo does *not* use HTTPS
|
|
96
111
|
|
|
97
112
|
## Notes
|
|
98
113
|
### Valid and invalid languages
|
|
@@ -113,4 +128,4 @@ Since the primary source for the data for this module has been NSD DBH's publica
|
|
|
113
128
|
|
|
114
129
|
### More than one language
|
|
115
130
|
|
|
116
|
-
We use the ISO 639
|
|
131
|
+
We use the ISO 639-3 `mul` code for these cases, which replaces the sometimes-used `mis` code if provided as input.
|