Locale API

Allows access to the Locale API.

Table of Contents


Summary of Interfaces and Methods

Interface Method
LocaleManagerObject
Locale DOMString getLocale();
void setLocale(DOMString newLocale);
void localeChanged(LocaleChangedCallback changeCallback);
LocaleChangedCallback

1. Interfaces

1.1. LocaleManagerObject

[NoInterfaceObject] interface LocaleManagerObject {
    readonly attribute Locale locale;
};
Tizen implements Locale;

1.2. Locale

The Vehicle interface defines access to locale functionality.
[NoInterfaceObject] interface Locale  {

    DOMString getLocale();

    void setLocale(DOMString newLocale);

    void localeChanged(LocaleChangedCallback changeCallback);

};

Methods

getLocale
Gets the current locale.
DOMString getLocale();

Return value:

Current locale in ISO 639-2 format (i.e., en_US for English US).
setLocale
Sets the system locale.
void setLocale(DOMString newLocale);

Parameters:

  • newLocale: Locale to set in ISO 639-2 format.
localeChanged
Subscribes a callback function to be invoked when locale changes.
void localeChanged(LocaleChangedCallback changeCallback);

Parameters:

  • changeCallback: Callback to be called when this event occurs.

1.3. LocaleChangedCallback

This interface specified a success callback that is invoked when current locale is changed.
[Callback=FunctionOnly, NoInterfaceObject] interface LocaleChangedCallback {

    void onsuccess(DOMString newLocale);

};

Methods

onsuccess
The callback function used to return a new locale. Called when current locale is changed successfully.
void onsuccess(DOMString newLocale);

Parameters:

  • newLocale: A new locale.

2. Full WebIDL

module Locale {

    [NoInterfaceObject] interface LocaleManagerObject {
        readonly attribute Locale locale;
    };

    Tizen implements Locale;

    [NoInterfaceObject] interface Locale  {

        DOMString getLocale();

        void setLocale(DOMString newLocale);

        void localeChanged(LocaleChangedCallback changeCallback);

    };

    [Callback=FunctionOnly, NoInterfaceObject] interface LocaleChangedCallback {

        void onsuccess(DOMString newLocale);

    };
};