Search in sources :

Example 1 with IntlObject

use of com.github.anba.es6draft.runtime.objects.intl.IntlObject 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);
    }
}
Also used : DateTimeFormatConstructor(com.github.anba.es6draft.runtime.objects.intl.DateTimeFormatConstructor) PluralRulesConstructor(com.github.anba.es6draft.runtime.objects.intl.PluralRulesConstructor) DateTimeFormatPrototype(com.github.anba.es6draft.runtime.objects.intl.DateTimeFormatPrototype) Intrinsics(com.github.anba.es6draft.runtime.types.Intrinsics) OrdinaryObject(com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject) NumberFormatPrototype(com.github.anba.es6draft.runtime.objects.intl.NumberFormatPrototype) CollatorPrototype(com.github.anba.es6draft.runtime.objects.intl.CollatorPrototype) IntlObject(com.github.anba.es6draft.runtime.objects.intl.IntlObject) PluralRulesPrototype(com.github.anba.es6draft.runtime.objects.intl.PluralRulesPrototype) CollatorConstructor(com.github.anba.es6draft.runtime.objects.intl.CollatorConstructor) NumberFormatConstructor(com.github.anba.es6draft.runtime.objects.intl.NumberFormatConstructor)

Aggregations

CollatorConstructor (com.github.anba.es6draft.runtime.objects.intl.CollatorConstructor)1 CollatorPrototype (com.github.anba.es6draft.runtime.objects.intl.CollatorPrototype)1 DateTimeFormatConstructor (com.github.anba.es6draft.runtime.objects.intl.DateTimeFormatConstructor)1 DateTimeFormatPrototype (com.github.anba.es6draft.runtime.objects.intl.DateTimeFormatPrototype)1 IntlObject (com.github.anba.es6draft.runtime.objects.intl.IntlObject)1 NumberFormatConstructor (com.github.anba.es6draft.runtime.objects.intl.NumberFormatConstructor)1 NumberFormatPrototype (com.github.anba.es6draft.runtime.objects.intl.NumberFormatPrototype)1 PluralRulesConstructor (com.github.anba.es6draft.runtime.objects.intl.PluralRulesConstructor)1 PluralRulesPrototype (com.github.anba.es6draft.runtime.objects.intl.PluralRulesPrototype)1 Intrinsics (com.github.anba.es6draft.runtime.types.Intrinsics)1 OrdinaryObject (com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject)1