Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Features about Number.prototype.toLocaleString() for IE11 in win7 and 8, a lot of related new definitions #52

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
471bb04
Update definitions.js
Clayblockunova Aug 10, 2024
d47ab81
Update features.js
Clayblockunova Aug 10, 2024
5e9e332
Update features.js
Clayblockunova Aug 10, 2024
3f4b70b
Update feature-emulation.helpers.js
Clayblockunova Aug 10, 2024
f767d8a
Update features.js
Clayblockunova Aug 18, 2024
a748e94
Update definitions.js
Clayblockunova Aug 18, 2024
3d416c7
Update features.js
Clayblockunova Aug 18, 2024
ceffd20
Update features.js
Clayblockunova Aug 18, 2024
a0e58f3
Update features.js
Clayblockunova Aug 18, 2024
a0255a5
Merge branch 'fasttime:main' into main
Clayblockunova Aug 18, 2024
25e3515
Update src/lib/features.js
Clayblockunova Aug 19, 2024
1f1e843
Update features.js
Clayblockunova Aug 19, 2024
760ec1e
Update features.js
Clayblockunova Aug 19, 2024
7dc440b
Update definitions.js
Clayblockunova Aug 19, 2024
608b237
Update feature-emulation.helpers.js
Clayblockunova Aug 19, 2024
7d1668f
Update features.js
Clayblockunova Aug 19, 2024
87324c4
Update definitions.js
Clayblockunova Aug 19, 2024
197f223
Update feature-emulation.helpers.js
Clayblockunova Aug 19, 2024
e2166d5
Update feature-emulation.helpers.js
Clayblockunova Aug 19, 2024
7afe4da
Update features.js
Clayblockunova Aug 19, 2024
8e4b739
Update features.js
Clayblockunova Aug 19, 2024
511cee2
Update features.js
Clayblockunova Aug 19, 2024
0157064
Update features.js
Clayblockunova Aug 19, 2024
f2beaf5
Update feature-emulation.helpers.js
Clayblockunova Aug 19, 2024
8f19980
Update feature-emulation.helpers.js
Clayblockunova Aug 19, 2024
6a9f30d
Update features.js
Clayblockunova Aug 19, 2024
ef7da3a
Update features.js
Clayblockunova Aug 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions src/lib/definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ function getFHPaddingEntries(index)
var LOCALE_INFINITY = Feature.LOCALE_INFINITY;
var LOCALE_NUMERALS = Feature.LOCALE_NUMERALS;
var LOCALE_NUMERALS_EXT = Feature.LOCALE_NUMERALS_EXT;
var LOCALE_NUMERALS_IE11_WIN7 = Feature.LOCALE_NUMERALS_IE11_WIN7;
var LOCATION = Feature.LOCATION;
var MOZILLA = Feature.MOZILLA;
var NAME = Feature.NAME;
Expand Down Expand Up @@ -1299,6 +1300,7 @@ function getFHPaddingEntries(index)
'∞':
[
define('Infinity[TO_LOCALE_STRING]()', LOCALE_INFINITY),
define('Infinity[TO_LOCALE_STRING]("ja")[1]', LOCALE_NUMERALS_IE11_WIN7),
define('Infinity[TO_LOCALE_STRING]("ja")[SLICE_OR_SUBSTR]("-1")', JAPANESE_INFINITY),
define('Infinity[TO_LOCALE_STRING]("ja").at("-1")', JAPANESE_INFINITY, AT),
defineCharDefault(),
Expand Down Expand Up @@ -2144,21 +2146,60 @@ function getFHPaddingEntries(index)
useLocaleNumeralDefinition('ي', '"ar"', NaN, 1);
useLocaleNumeralDefinition('س', '"ar"', NaN, 2);
useLocaleNumeralDefinition('ر', '"ar"', NaN, 4, LOCALE_NUMERALS_EXT);
useLocaleNumeralDefinition('ب', '"ar"', NaN, 4, LOCALE_NUMERALS_IE11_WIN7);
useLocaleNumeralDefinition('ق', '"ar"', NaN, 5, LOCALE_NUMERALS_EXT);
useLocaleNumeralDefinition('ر', '"ar"', NaN, 5, LOCALE_NUMERALS_IE11_WIN7);
useLocaleNumeralDefinition('م', '"ar"', NaN, 6, LOCALE_NUMERALS_EXT);
useLocaleNumeralDefinition('ق', '"ar"', NaN, 6, LOCALE_NUMERALS_IE11_WIN7);
useLocaleNumeralDefinition('م', '"ar"', NaN, 7, LOCALE_NUMERALS_IE11_WIN7);
useLocaleNumeralDefinition('ا', '"ar"', Infinity, 2, LOCALE_NUMERALS_IE11_WIN7);
useLocaleNumeralDefinition('ن', '"ar"', Infinity, 4, LOCALE_NUMERALS_IE11_WIN7);
useLocaleNumeralDefinition('ه', '"ar"', Infinity, 5, LOCALE_NUMERALS_IE11_WIN7);
useLocaleNumeralDefinition('ﺓ', '"ar"', Infinity, 8, LOCALE_NUMERALS_IE11_WIN7);
useLocaleNumeralDigitDefinitions('"bn"', 0x09e6, LOCALE_NUMERALS_EXT);
useLocaleNumeralDefinition('č', '"cs"', NaN, 5, LOCALE_NUMERALS_IE11_WIN7);
useLocaleNumeralDefinition('μ', '"el"', NaN, 0, LOCALE_NUMERALS_IE11_WIN7);
useLocaleNumeralDefinition('η', '"el"', NaN, 1, LOCALE_NUMERALS_IE11_WIN7);
useLocaleNumeralDefinition('α', '"el"', NaN, 3, LOCALE_NUMERALS_IE11_WIN7);
useLocaleNumeralDefinition('ρ', '"el"', NaN, 4, LOCALE_NUMERALS_IE11_WIN7);
useLocaleNumeralDefinition('ι', '"el"', NaN, 5, LOCALE_NUMERALS_IE11_WIN7);
useLocaleNumeralDefinition('θ', '"el"', NaN, 6, LOCALE_NUMERALS_IE11_WIN7);
useLocaleNumeralDefinition('ό', '"el"', NaN, 8, LOCALE_NUMERALS_IE11_WIN7);
useLocaleNumeralDefinition('ς', '"el"', NaN, 9, LOCALE_NUMERALS_IE11_WIN7);
useLocaleNumeralDefinition('Ά', '"el"', Infinity, 0, LOCALE_NUMERALS_IE11_WIN7);
useLocaleNumeralDefinition('π', '"el"', Infinity, 1, LOCALE_NUMERALS_IE11_WIN7);
useLocaleNumeralDefinition('ε', '"el"', Infinity, 2, LOCALE_NUMERALS_IE11_WIN7);
useLocaleNumeralDefinition('ο', '"el"', Infinity, 5, LOCALE_NUMERALS_IE11_WIN7);
useLocaleNumeralDigitDefinitions('"fa"', 0x06f0);
useLocaleNumeralDefinition('٬', '"fa"', 1000, 1);
useLocaleNumeralDefinition('ن', '"fa"', NaN, 0, LOCALE_NUMERALS_EXT);
useLocaleNumeralDefinition('ا', '"fa"', NaN, 1, LOCALE_NUMERALS_EXT);
useLocaleNumeralDefinition('ع', '"fa"', NaN, 2, LOCALE_NUMERALS_EXT);
useLocaleNumeralDefinition('د', '"fa"', NaN, 3, LOCALE_NUMERALS_EXT);
useLocaleNumeralDefinition('ל', '"he"', NaN, 0, LOCALE_NUMERALS_IE11_WIN7);
useLocaleNumeralDefinition('非', '"ja"', NaN, 5, LOCALE_NUMERALS_IE11_WIN7);
useLocaleNumeralDefinition('数', '"ja"', NaN, 6, LOCALE_NUMERALS_IE11_WIN7);
useLocaleNumeralDefinition('値', '"ja"', NaN, 7, LOCALE_NUMERALS_IE11_WIN7);
useLocaleNumeralDefinition('ė', '"lt"', Infinity, 7, LOCALE_NUMERALS_IE11_WIN7);
useLocaleNumeralDefinition('ī', '"lv"', Infinity, 6, LOCALE_NUMERALS_IE11_WIN7);
useLocaleNumeralDefinition('ś', '"pl"', Infinity, 13, LOCALE_NUMERALS_IE11_WIN7);
useLocaleNumeralDefinition('н', '"ru"', NaN, 0, LOCALE_NUMERALS_EXT);
useLocaleNumeralDefinition('е', '"ru"', NaN, 1, LOCALE_NUMERALS_EXT);
useLocaleNumeralDefinition('ч', '"ru"', NaN, 3, LOCALE_NUMERALS_EXT);
useLocaleNumeralDefinition('и', '"ru"', NaN, 4, LOCALE_NUMERALS_EXT);
useLocaleNumeralDefinition('с', '"ru"', NaN, 5, LOCALE_NUMERALS_EXT);
useLocaleNumeralDefinition('л', '"ru"', NaN, 6, LOCALE_NUMERALS_EXT);
useLocaleNumeralDefinition('о', '"ru"', NaN, 7, LOCALE_NUMERALS_EXT);
useLocaleNumeralDefinition('б', '"ru"', NaN, 0, LOCALE_NUMERALS_IE11_WIN7);
useLocaleNumeralDefinition('е', '"ru"', NaN, 1, LOCALE_NUMERALS_IE11_WIN7);
useLocaleNumeralDefinition('с', '"ru"', NaN, 2, LOCALE_NUMERALS_IE11_WIN7);
useLocaleNumeralDefinition('к', '"ru"', NaN, 3, LOCALE_NUMERALS_IE11_WIN7);
useLocaleNumeralDefinition('н', '"ru"', NaN, 5, LOCALE_NUMERALS_IE11_WIN7);
useLocaleNumeralDefinition('ч', '"ru"', NaN, 7, LOCALE_NUMERALS_IE11_WIN7);
useLocaleNumeralDefinition('о', '"ru"', NaN, 9, LOCALE_NUMERALS_IE11_WIN7);
useLocaleNumeralDefinition('т', '"ru"', NaN, 11, LOCALE_NUMERALS_IE11_WIN7);
useLocaleNumeralDefinition('ь', '"ru"', NaN, 12, LOCALE_NUMERALS_IE11_WIN7);
useLocaleNumeralDefinition('正', '"zh"', Infinity, 0, LOCALE_NUMERALS_IE11_WIN7);
useLocaleNumeralDefinition('字', '"zh-cn"', NaN, 2, LOCALE_NUMERALS_IE11_WIN7);
}
)();
58 changes: 50 additions & 8 deletions src/lib/features.js
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,47 @@ var featureInfos =
},
includes: ['LOCALE_NUMERALS'],
},
LOCALE_NUMERALS_IE11_WIN7:
{
description:
'Localized number formatting exclusive to Interner Explorer 11 in Windows 7.\n' +
'This includes all features of LOCALE_NUMERALS plus the output of the letters in the ' +
'second word of the Arabic string representation of NaN ("برقم"), the letters in the ' +
'Arabic string representation of Infinity ("+لا\xa0نهاية"), the letters in the the Czech ' +
'string representation of NaN ("Není\xa0číslo"), the letters in the the Greek string ' +
'representation of Infinity ("Άπειρο"), the letters in the Greek string representation of ' +
'NaN ("μη\xa0αριθμός"), the letters in the Hebrew string representation of NaN ' +
'("לא\xa0מספר"), the characters in the Japanese string representation of Infinity ' +
'("+∞"), the characters in the Japanese string representation of NaN ("NaN\xa0(非数値)"), ' +
'the letters in the Lithuanian string representation of Infinity ("begalybė"), the ' +
'letters in the Latvian string representation of Infinity ("bezgalība"), the letters in ' +
'the Polish string representation of Infinity ("+nieskończoność"), the letters in the ' +
'Russian string representation of Infinity ("бесконечность"), the characters in the ' +
'Chinese string representation of Infinity ("正无穷大" or "正無窮大"), the characters in ' +
'the Simplified Chinese string representation of NaN ("非数字").',
check:
function ()
{
var available =
checkLocaleNumeral('ar', NaN, /^ليس برقم/) &&
checkLocaleNumeral('ar', Infinity, /^+لا.نهاية/) &&
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm getting a syntax error on this regular expression.

checkLocaleNumeral('ar-td', 234567890.1, /^٢٣٤٬?٥٦٧٬?٨٩٠٫١/) &&
checkLocaleNumeral('cz', NaN, /^Není.číslo/) &&
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm trying this in IE 11 on Windows 7, but NaN.toLocaleString('cz') results in 'NaN'.

checkLocaleNumeral('el', Infinity, /^Άπειρο/) &&
checkLocaleNumeral('el', NaN, /^μη.αριθμός/) &&
checkLocaleNumeral('he', NaN, /^לא.מספר/) &&
checkLocaleNumeral('ja', Infinity, /^+∞/) &&
checkLocaleNumeral('ja', NaN, /^NaN.(非数値)/) &&
checkLocaleNumeral('lt', Infinity, /^begalybė/) &&
checkLocaleNumeral('lv', Infinity, /^bezgalība/) &&
checkLocaleNumeral('pl', Infinity, /^+nieskończoność/) &&
checkLocaleNumeral('ru', Infinity, /^бесконечность/) &&
checkLocaleNumeral('zh', Infinity, /^正/) &&
checkLocaleNumeral('zh-cn', NaN, /^非数字/);
return available;
},
includes: ['LOCALE_NUMERALS'],
},
LOCATION:
{
description:
Expand Down Expand Up @@ -1086,13 +1127,14 @@ var featureInfos =
versions: ['11'],
includes:
{
ANY_DOCUMENT: true,
DOCUMENT: false,
GMT: true,
JAPANESE_INFINITY: true,
LOCALE_NUMERALS: true,
PLAIN_INTL: true,
SHORT_LOCALES: true,
ANY_DOCUMENT: true,
DOCUMENT: false,
GMT: true,
JAPANESE_INFINITY: true,
LOCALE_NUMERALS: true,
LOCALE_NUMERALS_IE11_WIN7: true,
PLAIN_INTL: true,
SHORT_LOCALES: true,
},
},
IE_11_WIN_10:
Expand All @@ -1102,7 +1144,7 @@ var featureInfos =
compatibilityTag: 'on Windows 10',
compatibilityShortTag: 'W10',
includes:
{ LOCALE_INFINITY: true, LOCALE_NUMERALS: false, LOCALE_NUMERALS_EXT: true },
{ LOCALE_INFINITY: true, LOCALE_NUMERALS: false, LOCALE_NUMERALS_EXT: true, LOCALE_NUMERALS_IE11_WIN7: false },
},
NODE_0_10:
{
Expand Down
119 changes: 119 additions & 0 deletions test/helpers/feature-emulation.helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -1032,6 +1032,125 @@
}
);
},
LOCALE_NUMERALS_IE11_WIN7:
function ()
{
this.arabicNaNString = 'ليس\xa0برقم';
registerNumberToLocaleStringAdapter
(
this,
function (locale)
{
var returnValue;
var number;
switch (locale)
{
case 'ar':
case 'ar-td':
number = Number(this);
if (isNaN(number))
returnValue = 'ليس\xa0برقم';
else
{
switch (+this) // In Internet Explorer 9, +this is different from this.
{
case Infinity:
return '+لا\xa0نهاية';
case -Infinity:
return '-لا\xa0نهاية';
}
}
break;
case 'cz':
number = Number(this);
if (isNaN(number))
returnValue = 'Není\xa0číslo';
break;
case 'el':
number = Number(this);
if (isNaN(number))
returnValue = 'μη\xa0αριθμός';
else
{
switch (+this) // In Internet Explorer 9, +this is different from this.
{
case Infinity:
return 'Άπειρο';
case -Infinity:
return '-Άπειρο';
}
}
break;
case 'he':
number = Number(this);
if (isNaN(number))
returnValue = 'לא\xa0מספר';
break;
case 'ja':
number = Number(this);
if (isNaN(number))
returnValue = 'NaN\xa0(非数値)';
else
{
switch (+this) // In Internet Explorer 9, +this is different from this.
{
case Infinity:
return '+∞';
case -Infinity:
return '-∞';
}
}
break;
case 'lt':
switch (+this) // In Internet Explorer 9, +this is different from this.
{
case Infinity:
return 'begalybė';
case -Infinity:
return '-begalybė';
}
case 'lv':
switch (+this) // In Internet Explorer 9, +this is different from this.
{
case Infinity:
return 'bezgalība';
case -Infinity:
return '-bezgalība';
}
case 'pl':
switch (+this) // In Internet Explorer 9, +this is different from this.
{
case Infinity:
return '+nieskończoność';
case -Infinity:
return '-nieskończoność';
}
case 'ru':
switch (+this) // In Internet Explorer 9, +this is different from this.
{
case Infinity:
return 'бесконечность';
case -Infinity:
return '-бесконечность';
}
case 'zh':
switch (+this) // In Internet Explorer 9, +this is different from this.
{
case Infinity:
return '正无穷大';
case -Infinity:
return '负无穷大';
}
}
case 'zh-cn':
number = Number(this);
if (isNaN(number))
returnValue = '非数字';
break;
return returnValue;
}
);
},
LOCALE_NUMERALS_EXT:
function ()
{
Expand Down
Loading