You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/lib/processors/manifestEnhancer.js
+67-5
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,34 @@ import test from "ava";
2
2
importsinonGlobalfrom"sinon";
3
3
importesmockfrom"esmock";
4
4
5
+
functionisValidBCP47Locale(locale){
6
+
if(locale===""){
7
+
// Special handling of empty string, as this marks the developer locale (without locale information)
8
+
returntrue;
9
+
}
10
+
11
+
// See https://github.com/SAP/openui5/blob/a8f36e430f1fac172eb705811da4a2af25483408/src/sap.ui.core/src/sap/base/i18n/ResourceBundle.js#L30
12
+
/**
13
+
* A regular expression that describes language tags according to BCP-47.
14
+
*
15
+
* @see BCP47 "Tags for Identifying Languages" (http://www.ietf.org/rfc/bcp/bcp47.txt)
16
+
*
17
+
* The matching groups are
18
+
* 0=all
19
+
* 1=language (shortest ISO639 code + ext. language sub tags | 4digits (reserved) | registered language sub tags)
20
+
* 2=script (4 letters)
21
+
* 3=region (2letter language or 3 digits)
22
+
* 4=variants (separated by '-', Note: capturing group contains leading '-' to shorten the regex!)
23
+
* 5=extensions (including leading singleton, multiple extensions separated by '-')
24
+
* 6=private use section (including leading 'x', multiple sections separated by '-')
25
+
*/
26
+
27
+
// eslint-disable-next-line max-len
28
+
// [-------------------- language ----------------------][--- script ---][------- region --------][------------- variants --------------][----------- extensions ------------][------ private use -------]
0 commit comments