use of com.github.anba.es6draft.runtime.objects.intl.CollatorConstructor in project es6draft by anba.
the class Realm method initializeInternationalisation.
/**
* <h1>Internationalisation API (ECMA-402)</h1><br>
* <h2>8 The Intl Object - 12 DateTimeFormat Objects</h2>
*
* Additional built-in objects from the Internationalisation API
*
* @param realm
* the realm instance
*/
private static void initializeInternationalisation(Realm realm) {
EnumMap<Intrinsics, OrdinaryObject> intrinsics = realm.intrinsics;
// allocation phase
IntlObject intlObject = new IntlObject(realm);
CollatorConstructor collatorConstructor = new CollatorConstructor(realm);
CollatorPrototype collatorPrototype = new CollatorPrototype(realm);
NumberFormatConstructor numberFormatConstructor = new NumberFormatConstructor(realm);
NumberFormatPrototype numberFormatPrototype = new NumberFormatPrototype(realm);
DateTimeFormatConstructor dateTimeFormatConstructor = new DateTimeFormatConstructor(realm);
DateTimeFormatPrototype dateTimeFormatPrototype = new DateTimeFormatPrototype(realm);
PluralRulesConstructor pluralRulesConstructor = null;
PluralRulesPrototype pluralRulesPrototype = null;
if (realm.isEnabled(CompatibilityOption.PluralRules)) {
pluralRulesConstructor = new PluralRulesConstructor(realm);
pluralRulesPrototype = new PluralRulesPrototype(realm);
}
// registration phase
intrinsics.put(Intrinsics.Intl, intlObject);
intrinsics.put(Intrinsics.Intl_Collator, collatorConstructor);
intrinsics.put(Intrinsics.Intl_CollatorPrototype, collatorPrototype);
intrinsics.put(Intrinsics.Intl_NumberFormat, numberFormatConstructor);
intrinsics.put(Intrinsics.Intl_NumberFormatPrototype, numberFormatPrototype);
intrinsics.put(Intrinsics.Intl_DateTimeFormat, dateTimeFormatConstructor);
intrinsics.put(Intrinsics.Intl_DateTimeFormatPrototype, dateTimeFormatPrototype);
if (pluralRulesConstructor != null) {
intrinsics.put(Intrinsics.Intl_PluralRules, pluralRulesConstructor);
intrinsics.put(Intrinsics.Intl_PluralRulesPrototype, pluralRulesPrototype);
}
// initialization phase
intlObject.initialize(realm);
collatorConstructor.initialize(realm);
collatorPrototype.initialize(realm);
numberFormatConstructor.initialize(realm);
numberFormatPrototype.initialize(realm);
dateTimeFormatConstructor.initialize(realm);
dateTimeFormatPrototype.initialize(realm);
if (pluralRulesConstructor != null) {
pluralRulesConstructor.initialize(realm);
pluralRulesPrototype.initialize(realm);
}
}
Aggregations