@@ -142,54 +142,47 @@ function set_isLanguageSmart() {
142
142
// last checked 13.5.1
143
143
localesSupported = {
144
144
// v hashes are with localized NumberRangeOver/Underflow
145
- 'ar' : { m : '1f9a06e3' , v : '1dfb5b8c' , x : 'ebfbdc43' } ,
146
- 'be' : { m : '076d68e6' , v : '4edeafab' , x : 'b74b3840' } ,
147
- 'bg' : { m : '2da6c02e' , v : 'ce892c88' , x : '914590a4' } ,
148
- 'ca' : { m : 'd856d812' , v : '6b3bb3d8' , x : '81f31519' } ,
149
- 'cs' : { m : 'c92accb0' , v : 'de3ab0ad' , x : '45f277f7' } ,
150
- 'da' : { m : '39169214' , v : '479797a1' , x : '44535972' } ,
151
- 'de' : { m : '298d11c6' , v : 'f9e2eae6' , x : 'f4b2a56f' } ,
152
- // el: xml n30 = english but is would-be-n39 'reserved prefix (xmlns) must not be declared or undeclared'
153
- // changing to spoof english returns n30.. phew!
154
- 'el' : { m : '7053311d' , v : 'b1a88a13' , x : 'da8c80af' } ,
155
- 'en-US' : { m : '05c30936' , v : '41310558' , x : '945f8952' } ,
156
- 'es-ES' : { m : '96b78cbd' , v : '97c3f5a9' , x : '3eeba3bc' } ,
157
- 'fa' : { m : '6648d919' , v : '8ef57409' , x : '113d0a7e' } ,
158
- 'fi' : { m : '82d079c7' , v : '3e29e6e7' , x : '71abeeec' } ,
159
- 'fr' : { m : '024d0fce' , v : '34e28fa2' , x : '74f5df3d' } ,
160
- 'ga-IE' : { m : '97fca229' , v : '2bf1321d' , x : 'd9761e70' } ,
161
- // he: xml n27 n28 n30 = english
162
- 'he' : { m : 'cdde832b' , v : 'e47dbb82' , x : '786876d5' } ,
163
- 'hu' : { m : 'db7366e6' , v : 'dad6d689' , x : '9f537fe6' } ,
164
- 'id' : { m : '1e275882' , v : '71224946' , x : '79f3851e' } ,
165
- 'is' : { m : '204c8f73' , v : '6bbe7a8f' , x : '7f3e38b8' } ,
166
- 'it' : { m : '716e7242' , v : '3b781f09' , x : '469cb2af' } ,
167
- 'ja' : { m : 'ab56d7cb' , v : '48645d06' , x : '46faea8b' } ,
168
- 'ka' : { m : '6961b7e4' , v : '40feb44f' , x : '4e712712' } ,
169
- 'ko' : { m : 'c758b027' , v : 'd3b54047' , x : 'fc4c50ed' } ,
170
- 'lt' : { m : 'c36fbafb' , v : 'd5f9b95d' , x : 'f50f2b50' } ,
171
- // mk: v = english but not number format, and xml n30 = english but is would-be-n39 (same as el)
172
- // and n27 n28 = english
173
- 'mk' : { m : '78274f1b' , v : '333aae58' , x : '3b22df8b' } ,
174
- 'ms' : { m : '3e26c6be' , v : '9dadbc64' , x : 'f23d0969' } ,
175
- // my: two items in english: date+over/under
176
- 'my' : { m : '939f2013' , v : '43cc3aa3' , x : '11d4d458' } ,
177
- // nb-NO: xml most is english
178
- 'nb-NO' : { m : '1d496fea' , v : '84ce54eb' , x : '50426960' } ,
179
- 'nl' : { m : 'e1d3b281' , v : '326cbfd2' , x : 'b03574e4' } ,
180
- 'pl' : { m : '0bd88e98' , v : '95ad4851' , x : 'c1295e2b' } ,
181
- 'pt-BR' : { m : '39835e93' , v : 'de2c3569' , x : '96f79e68' } ,
182
- 'pt-PT' : { m : '6ae9a13a' , v : 'b21f3984' , x : 'b42389f7' } ,
183
- 'ro' : { m : '3e321768' , v : 'd72a350b' , x : 'cf85bb64' } ,
184
- 'ru' : { m : '8e9b7945' , v : '2391fbec' , x : '2178a2b6' } ,
185
- 'sq' : { m : '91943e67' , v : 'e0259277' , x : 'a732eca1' } ,
186
- 'sv-SE' : { m : 'bc792ce2' , v : 'd9d7828b' , x : '80f52165' } ,
187
- 'th' : { m : 'a32d70a7' , v : '07358a87' , x : 'e29567ce' } ,
188
- 'tr' : { m : '4217ef80' , v : '5048d312' , x : 'e16dd3c7' } ,
189
- 'uk' : { m : '3e2b3e39' , v : '0163f51d' , x : 'cc85d2f5' } ,
190
- 'vi' : { m : 'bba6c980' , v : 'b8137d59' , x : '7cf3c6f9' } ,
191
- 'zh-Hans-CN' : { m : '550ea53e' , v :'0e58f82a' , x : '328cc79b' } ,
192
- 'zh-Hant-TW' : { m : '66b515a4' , v : '8e4cfa0e' , x : '87abb9fa' } ,
145
+ 'ar' : { m : '1f9a06e3' , v : '1dfb5b8c' , x : '71982b47' } ,
146
+ 'be' : { m : '076d68e6' , v : '4edeafab' , x : '42583d22' } ,
147
+ 'bg' : { m : '2da6c02e' , v : 'ce892c88' , x : 'c4f06f98' } ,
148
+ 'ca' : { m : 'd856d812' , v : '6b3bb3d8' , x : '77a62a49' } ,
149
+ 'cs' : { m : 'c92accb0' , v : 'de3ab0ad' , x : '81c91d49' } ,
150
+ 'da' : { m : '39169214' , v : '479797a1' , x : 'a30818e8' } ,
151
+ 'de' : { m : '298d11c6' , v : 'f9e2eae6' , x : 'c1ce6571' } ,
152
+ 'el' : { m : '7053311d' , v : 'b1a88a13' , x : '493f7225' } ,
153
+ 'en-US' : { m : '05c30936' , v : '41310558' , x : '544e1ae8' } ,
154
+ 'es-ES' : { m : '96b78cbd' , v : '97c3f5a9' , x : 'ed807f70' } ,
155
+ 'fa' : { m : '6648d919' , v : '8ef57409' , x : '1ed34bca' } ,
156
+ 'fi' : { m : '82d079c7' , v : '3e29e6e7' , x : '859efc32' } ,
157
+ 'fr' : { m : '024d0fce' , v : '34e28fa2' , x : '1d2050d3' } ,
158
+ 'ga-IE' : { m : '97fca229' , v : '2bf1321d' , x : 'd3af2cd8' } ,
159
+ 'he' : { m : 'cdde832b' , v : 'e47dbb82' , x : 'c7274a3e' } ,
160
+ 'hu' : { m : 'db7366e6' , v : 'dad6d689' , x : 'e4f85168' } ,
161
+ 'id' : { m : '1e275882' , v : '71224946' , x : 'a70cd23c' } ,
162
+ 'is' : { m : '204c8f73' , v : '6bbe7a8f' , x : 'edb8b212' } ,
163
+ 'it' : { m : '716e7242' , v : '3b781f09' , x : 'c567f479' } ,
164
+ 'ja' : { m : 'ab56d7cb' , v : '48645d06' , x : 'a58f6165' } ,
165
+ 'ka' : { m : '6961b7e4' , v : '40feb44f' , x : 'bfbc28c2' } ,
166
+ 'ko' : { m : 'c758b027' , v : 'd3b54047' , x : '1235e26d' } ,
167
+ 'lt' : { m : 'c36fbafb' , v : 'd5f9b95d' , x : 'b0e8a3bc' } ,
168
+ 'mk' : { m : '78274f1b' , v : '333aae58' , x : 'b6020ec1' } ,
169
+ 'ms' : { m : '3e26c6be' , v : '9dadbc64' , x : '15e6148f' } ,
170
+ 'my' : { m : '939f2013' , v : '43cc3aa3' , x : 'a6571ec7' } ,
171
+ 'nb-NO' : { m : '1d496fea' , v : '84ce54eb' , x : 'e0d34e04' } ,
172
+ 'nl' : { m : 'e1d3b281' , v : '326cbfd2' , x : 'caef95fc' } ,
173
+ 'pl' : { m : '0bd88e98' , v : '95ad4851' , x : '2a45177d' } ,
174
+ 'pt-BR' : { m : '39835e93' , v : 'de2c3569' , x : '68f80c66' } ,
175
+ 'pt-PT' : { m : '6ae9a13a' , v : 'b21f3984' , x : '0aa2a309' } ,
176
+ 'ro' : { m : '3e321768' , v : 'd72a350b' , x : 'a9da3416' } ,
177
+ 'ru' : { m : '8e9b7945' , v : '2391fbec' , x : '26f663da' } ,
178
+ 'sq' : { m : '91943e67' , v : 'e0259277' , x : '4e0bbdcd' } ,
179
+ 'sv-SE' : { m : 'bc792ce2' , v : 'd9d7828b' , x : '4af3452f' } ,
180
+ 'th' : { m : 'a32d70a7' , v : '07358a87' , x : '2a04071a' } ,
181
+ 'tr' : { m : '4217ef80' , v : '5048d312' , x : '55daef93' } ,
182
+ 'uk' : { m : '3e2b3e39' , v : '0163f51d' , x : '4f817ea3' } ,
183
+ 'vi' : { m : 'bba6c980' , v : 'b8137d59' , x : '80da1efb' } ,
184
+ 'zh-Hans-CN' : { m : '550ea53e' , v :'0e58f82a' , x : '536abb21' } ,
185
+ 'zh-Hant-TW' : { m : '66b515a4' , v : '8e4cfa0e' , x : '9ad3338c' } ,
193
186
}
194
187
// mac: japanese languages are the same but the locale is 'ja-JP' not 'ja'
195
188
if ( 'mac' == isOS ) {
@@ -809,6 +802,99 @@ function get_locale_resolvedoptions(METRIC) {
809
802
return
810
803
}
811
804
805
+ const get_messages_media = ( METRIC ) => new Promise ( resolve => {
806
+ let hash , btn = '' , data = { } , notation = isLanguageSmart ? locale_red : ""
807
+ try {
808
+ let aList = [ 'Invalid' , 'Scaled' ]
809
+ for ( const k of aList ) {
810
+ let name = k + 'Image'
811
+ let target = dom [ name ] , title = ''
812
+ if ( 'Scaled' == k ) {
813
+ title = target . contentWindow . document . title
814
+ title = title . replace ( name + '.png' , '' ) // strip image name to reduce noise
815
+ } else {
816
+ const image = target . contentWindow . document . querySelector ( 'img' )
817
+ title = image . alt
818
+ title = title . replace ( target . src , '' ) // remove noise
819
+ }
820
+ data [ name ] = title . trim ( )
821
+ }
822
+ hash = mini ( data ) ; btn = addButton ( 4 , METRIC )
823
+ if ( isLanguageSmart ) {
824
+ if ( isLocaleValid && localesSupported [ isLocaleAlt ] !== undefined ) {
825
+ if ( hash === localesSupported [ isLocaleAlt ] . m ) { notation = locale_green }
826
+ }
827
+ }
828
+ } catch ( e ) {
829
+ hash = e ; data = zErrLog
830
+ }
831
+ addBoth ( 4 , METRIC , hash , btn , notation , data )
832
+ return resolve ( )
833
+ } )
834
+
835
+ function get_messages_validation ( METRIC ) {
836
+ const aNames = [ 'BadInputNumber' , 'CheckboxMissing' , 'DateTimeRangeOverflow' , 'DateTimeRangeUnderflow' ,
837
+ 'FileMissing' , 'InvalidEmail' , 'InvalidURL' , 'NumberRangeOverflow' , 'NumberRangeUnderflow' ,
838
+ 'PatternMismatch' , 'RadioMissing' , 'SelectMissing' , 'StepMismatch' , 'ValueMissing' , ]
839
+ const input = "<input type='number' required>"
840
+ + "<input type='checkbox' required>"
841
+ + "<input type='date' value='2024-01-01' max='2023-12-31'>"
842
+ + "<input type='date' value='2022-01-01' min='2023-12-31'>"
843
+ + "<input type='file' required>"
844
+ + "<input type='email' value='a'>"
845
+ + "<input type='url' value='a'>"
846
+ + "<input type='number' max='1974.3' value='2000'>"
847
+ + "<input type='number' min='8026.5' value='1'>"
848
+ + "<input type='tel' pattern='[0-9]{1}' value='a'>"
849
+ + "<input type='radio' required name='radiogroup'>"
850
+ + "<select required><option></option></select>"
851
+ + "<input type='number' min='1.2345' step='1005.5545' value='2'>"
852
+ + "<input type='text' required>"
853
+
854
+ let hash , btn = '' , data = { } , notation = isLanguageSmart ? locale_red : ''
855
+ try {
856
+ let collection = ( ( new DOMParser ) . parseFromString ( input , 'text/html' ) ) . body . children
857
+ let cType = typeFn ( collection )
858
+ if ( 'object' !== cType ) { throw zErrType + cType }
859
+ for ( const k of Object . keys ( collection ) ) {
860
+ let msg = collection [ k ] . validationMessage
861
+ if ( runST ) { msg = undefined }
862
+ let typeCheck = typeFn ( msg )
863
+ if ( 'string' !== typeCheck ) { throw zErrType + typeCheck }
864
+ data [ aNames [ k ] ] = msg
865
+ }
866
+ hash = mini ( data )
867
+ let count = Object . keys ( data ) . length
868
+ let details = count === aNames . length ? 'details' : count + '/' + aNames . length
869
+ btn = addButton ( 4 , METRIC , details )
870
+ if ( isLanguageSmart ) {
871
+ if ( isLocaleValid && localesSupported [ isLocaleAlt ] !== undefined ) {
872
+ if ( hash === localesSupported [ isLocaleAlt ] . v ) { notation = locale_green }
873
+ }
874
+ }
875
+ } catch ( e ) {
876
+ hash = e ; data = zErrLog
877
+ }
878
+ addBoth ( 4 , METRIC , hash , btn , notation , data )
879
+ return
880
+ }
881
+
882
+ function get_messages_xml ( METRIC ) {
883
+ let hash , btn = '' , data = isXML , notation = isLanguageSmart ? locale_red : ""
884
+ if ( 'string' == typeof isXML ) {
885
+ hash = isXML ; data = isXML == zNA ? '' : zErrLog
886
+ } else {
887
+ hash = mini ( isXML ) ; btn = addButton ( 4 , METRIC )
888
+ if ( isLanguageSmart ) {
889
+ if ( isLocaleValid && localesSupported [ isLocaleAlt ] !== undefined ) {
890
+ if ( hash === localesSupported [ isLocaleAlt ] . x ) { notation = locale_green }
891
+ }
892
+ }
893
+ }
894
+ addBoth ( 4 , METRIC , hash , btn , notation , data )
895
+ return
896
+ }
897
+
812
898
function get_timezone ( METRIC ) {
813
899
let t0 = nowFn ( )
814
900
const METRICtz = 'timezone'
@@ -1158,99 +1244,6 @@ function get_timezone_offset(METRIC) {
1158
1244
return
1159
1245
}
1160
1246
1161
- const get_media_messages = ( METRIC ) => new Promise ( resolve => {
1162
- let hash , btn = '' , data = { } , notation = isLanguageSmart ? locale_red : ""
1163
- try {
1164
- let aList = [ 'Invalid' , 'Scaled' ]
1165
- for ( const k of aList ) {
1166
- let name = k + 'Image'
1167
- let target = dom [ name ] , title = ''
1168
- if ( 'Scaled' == k ) {
1169
- title = target . contentWindow . document . title
1170
- title = title . replace ( name + '.png' , '' ) // strip image name to reduce noise
1171
- } else {
1172
- const image = target . contentWindow . document . querySelector ( 'img' )
1173
- title = image . alt
1174
- title = title . replace ( target . src , '' ) // remove noise
1175
- }
1176
- data [ name ] = title . trim ( )
1177
- }
1178
- hash = mini ( data ) ; btn = addButton ( 4 , METRIC )
1179
- if ( isLanguageSmart ) {
1180
- if ( isLocaleValid && localesSupported [ isLocaleAlt ] !== undefined ) {
1181
- if ( hash === localesSupported [ isLocaleAlt ] . m ) { notation = locale_green }
1182
- }
1183
- }
1184
- } catch ( e ) {
1185
- hash = e ; data = zErrLog
1186
- }
1187
- addBoth ( 4 , METRIC , hash , btn , notation , data )
1188
- return resolve ( )
1189
- } )
1190
-
1191
- function get_validation_messages ( METRIC ) {
1192
- const aNames = [ 'BadInputNumber' , 'CheckboxMissing' , 'DateTimeRangeOverflow' , 'DateTimeRangeUnderflow' ,
1193
- 'FileMissing' , 'InvalidEmail' , 'InvalidURL' , 'NumberRangeOverflow' , 'NumberRangeUnderflow' ,
1194
- 'PatternMismatch' , 'RadioMissing' , 'SelectMissing' , 'StepMismatch' , 'ValueMissing' , ]
1195
- const input = "<input type='number' required>"
1196
- + "<input type='checkbox' required>"
1197
- + "<input type='date' value='2024-01-01' max='2023-12-31'>"
1198
- + "<input type='date' value='2022-01-01' min='2023-12-31'>"
1199
- + "<input type='file' required>"
1200
- + "<input type='email' value='a'>"
1201
- + "<input type='url' value='a'>"
1202
- + "<input type='number' max='1974.3' value='2000'>"
1203
- + "<input type='number' min='8026.5' value='1'>"
1204
- + "<input type='tel' pattern='[0-9]{1}' value='a'>"
1205
- + "<input type='radio' required name='radiogroup'>"
1206
- + "<select required><option></option></select>"
1207
- + "<input type='number' min='1.2345' step='1005.5545' value='2'>"
1208
- + "<input type='text' required>"
1209
-
1210
- let hash , btn = '' , data = { } , notation = isLanguageSmart ? locale_red : ''
1211
- try {
1212
- let collection = ( ( new DOMParser ) . parseFromString ( input , 'text/html' ) ) . body . children
1213
- let cType = typeFn ( collection )
1214
- if ( 'object' !== cType ) { throw zErrType + cType }
1215
- for ( const k of Object . keys ( collection ) ) {
1216
- let msg = collection [ k ] . validationMessage
1217
- if ( runST ) { msg = undefined }
1218
- let typeCheck = typeFn ( msg )
1219
- if ( 'string' !== typeCheck ) { throw zErrType + typeCheck }
1220
- data [ aNames [ k ] ] = msg
1221
- }
1222
- hash = mini ( data )
1223
- let count = Object . keys ( data ) . length
1224
- let details = count === aNames . length ? 'details' : count + '/' + aNames . length
1225
- btn = addButton ( 4 , METRIC , details )
1226
- if ( isLanguageSmart ) {
1227
- if ( isLocaleValid && localesSupported [ isLocaleAlt ] !== undefined ) {
1228
- if ( hash === localesSupported [ isLocaleAlt ] . v ) { notation = locale_green }
1229
- }
1230
- }
1231
- } catch ( e ) {
1232
- hash = e ; data = zErrLog
1233
- }
1234
- addBoth ( 4 , METRIC , hash , btn , notation , data )
1235
- return
1236
- }
1237
-
1238
- function get_xml_messages ( METRIC ) {
1239
- let hash , btn = '' , data = isXML , notation = isLanguageSmart ? locale_red : ""
1240
- if ( 'string' == typeof isXML ) {
1241
- hash = isXML ; data = isXML == zNA ? '' : zErrLog
1242
- } else {
1243
- hash = mini ( isXML ) ; btn = addButton ( 4 , METRIC )
1244
- if ( isLanguageSmart ) {
1245
- if ( isLocaleValid && localesSupported [ isLocaleAlt ] !== undefined ) {
1246
- if ( hash === localesSupported [ isLocaleAlt ] . x ) { notation = locale_green }
1247
- }
1248
- }
1249
- }
1250
- addBoth ( 4 , METRIC , hash , btn , notation , data )
1251
- return
1252
- }
1253
-
1254
1247
const get_dates = ( ) => new Promise ( resolve => {
1255
1248
let d = new Date ( Date . UTC ( 2023 , 0 , 1 , 0 , 0 , 1 ) ) //
1256
1249
let o = { weekday : "long" , month : "long" , day : "numeric" , year : "numeric" , hour : "numeric" ,
@@ -1358,13 +1351,13 @@ const outputRegion = () => new Promise(resolve => {
1358
1351
get_locale_resolvedoptions ( 'locale_resolvedoptions' ) ,
1359
1352
get_locale_intl ( ) ,
1360
1353
get_timezone ( 'timezone_offsets' ) , // sets isTimeZoneValid/Value
1361
- get_validation_messages ( 'messages_validation' ) ,
1362
- get_xml_messages ( 'messages_xml' ) ,
1354
+ get_messages_validation ( 'messages_validation' ) ,
1355
+ get_messages_xml ( 'messages_xml' ) ,
1363
1356
] ) . then ( function ( ) {
1364
1357
Promise . all ( [
1365
1358
get_timezone_offset ( 'timezone_offset' ) , // might use isTimeZoneValid/Value
1366
1359
get_dates ( ) , // will use isTimeZoneValid/Value + isLocaleValid/Value
1367
- get_media_messages ( 'messages_media' ) ,
1360
+ get_messages_media ( 'messages_media' ) ,
1368
1361
] ) . then ( function ( ) {
1369
1362
return resolve ( )
1370
1363
} )
0 commit comments