Struct xpcom::interfaces::mozILocaleService
[−]
[src]
#[repr(C)]pub struct mozILocaleService { /* fields omitted */ }
interface mozILocaleService : nsISupports
Methods
impl mozILocaleService
[src]
pub fn coerce<T: mozILocaleServiceCoerce>(&self) -> &T
[src]
Cast this mozILocaleService
to one of its base interfaces.
impl mozILocaleService
[src]
pub const langNegStrategyFiltering: i64
langNegStrategyFiltering: i64 = 0
/**
* List of language negotiation strategies to use.
* For an example list of requested and available locales:
*
* Requested: ['es-MX', 'fr-FR']
* Available: ['fr', 'fr-CA', 'es', 'es-MX', 'it']
* DefaultLocale: ['en-US']
*
* each of those strategies will build a different result:
*
*
* filtering (default) -
* Matches as many of the available locales as possible.
*
* Result:
* Supported: ['es-MX', 'es', 'fr', 'fr-CA', 'en-US']
*
* matching -
* Matches the best match from the available locales for every requested
* locale.
*
* Result:
* Supported: ['es-MX', 'fr', 'en-US']
*
* lookup -
* Matches a single best locale. This strategy always returns a list
* of the length 1 and requires a defaultLocale to be set.
*
* Result:
* Supported: ['es-MX']
*/
pub const langNegStrategyMatching: i64
langNegStrategyMatching: i64 = 1
pub const langNegStrategyLookup: i64
langNegStrategyLookup: i64 = 2
pub unsafe fn GetDefaultLocale(
&self,
aDefaultLocale: &mut nsACString
) -> nsresult
[src]
&self,
aDefaultLocale: &mut nsACString
) -> nsresult
/**
* Default locale of the browser. The locale we are guaranteed to have
* resources for that should be used as a last resort fallack in cases
* where requested locales do not match available locales.
*/
readonly attribute ACString defaultLocale;
pub unsafe fn GetLastFallbackLocale(
&self,
aLastFallbackLocale: &mut nsACString
) -> nsresult
[src]
&self,
aLastFallbackLocale: &mut nsACString
) -> nsresult
/**
* Last fallback is the final fallback locale we're going to attempt if all
* else fails in any language negotiation or locale resource retrieval situations.
*
* At the moment it returns `en-US`.
*/
readonly attribute ACString lastFallbackLocale;
pub unsafe fn GetAppLocalesAsLangTags(
&self,
aCount: *mut uint32_t,
aLocales: *mut *mut *const c_char
) -> nsresult
[src]
&self,
aCount: *mut uint32_t,
aLocales: *mut *mut *const c_char
) -> nsresult
/**
* Returns a list of locales that the application should be localized to.
*
* The result is a ordered list of valid locale IDs and it should be
* used for all APIs that accept list of locales, like ECMA402 and L10n APIs.
*
* This API always returns at least one locale.
*
* When retrieving the locales for language negotiation and matching
* to language resources, use the language tag form.
* When retrieving the locales for Intl API or ICU locale settings,
* use the BCP47 form.
*
* Example: ["en-US", "de", "pl", "sr-Cyrl", "zh-Hans-HK"]
*
* (See LocaleService.h for a more C++-friendly version of this.)
*/
void getAppLocalesAsLangTags ([optional] out unsigned long aCount, [array, size_is (aCount), retval] out string aLocales);
pub unsafe fn GetAppLocalesAsBCP47(
&self,
aCount: *mut uint32_t,
aLocales: *mut *mut *const c_char
) -> nsresult
[src]
&self,
aCount: *mut uint32_t,
aLocales: *mut *mut *const c_char
) -> nsresult
void getAppLocalesAsBCP47 ([optional] out unsigned long aCount, [array, size_is (aCount), retval] out string aLocales);
pub unsafe fn GetRegionalPrefsLocales(
&self,
aCount: *mut uint32_t,
aOutArray: *mut *mut *const c_char
) -> nsresult
[src]
&self,
aCount: *mut uint32_t,
aOutArray: *mut *mut *const c_char
) -> nsresult
/**
* Returns a list of locales to use for any regional specific operations
* like date formatting, calendars, unit formatting etc.
*
* The result is a ordered list of valid locale IDs and it should be
* used for all APIs that accept list of locales, like ECMA402 and L10n APIs.
*
* This API always returns at least one locale.
*
* Example: ["en-US", "de", "pl", "sr-Cyrl", "zh-Hans-HK"]
*
* (See LocaleService.h for a more C++-friendly version of this.)
*/
void getRegionalPrefsLocales ([optional] out unsigned long aCount, [array, size_is (aCount), retval] out string aOutArray);
pub unsafe fn NegotiateLanguages(
&self,
aRequested: *mut *const c_char,
aAvailable: *mut *const c_char,
aDefaultLocale: *const c_char,
langNegStrategy: int32_t,
aRequestedCount: uint32_t,
aAvailableCount: uint32_t,
aCount: *mut uint32_t,
aLocales: *mut *mut *const c_char
) -> nsresult
[src]
&self,
aRequested: *mut *const c_char,
aAvailable: *mut *const c_char,
aDefaultLocale: *const c_char,
langNegStrategy: int32_t,
aRequestedCount: uint32_t,
aAvailableCount: uint32_t,
aCount: *mut uint32_t,
aLocales: *mut *mut *const c_char
) -> nsresult
/**
* Negotiates the best locales out of a ordered list of requested locales and
* a list of available locales.
*
* Internally it uses the following naming scheme:
*
* Requested - locales requested by the user
* Available - locales for which the data is available
* Supported - locales negotiated by the algorithm
*
* Additionally, if defaultLocale is provided, it adds it to the end of the
* result list as a "last resort" locale.
*
* Strategy is one of the three strategies described at the top of this file.
*
* The result list is ordered according to the order of the requested locales.
*
* (See LocaleService.h for a more C++-friendly version of this.)
*/
void negotiateLanguages ([array, size_is (aRequestedCount)] in string aRequested, [array, size_is (aAvailableCount)] in string aAvailable, [optional] in string aDefaultLocale, [optional] in long langNegStrategy, [optional] in unsigned long aRequestedCount, [optional] in unsigned long aAvailableCount, [optional] out unsigned long aCount, [array, size_is (aCount), retval] out string aLocales);
pub unsafe fn GetAppLocaleAsLangTag(&self, _retval: &mut nsACString) -> nsresult
[src]
/**
* Returns the best locale that the application should be localized to.
*
* The result is a valid locale ID and it should be
* used for all APIs that do not handle language negotiation.
*
* When retrieving the locales for language negotiation and matching
* to language resources, use the language tag form.
* When retrieving the locales for Intl API or ICU locale settings,
* use the BCP47 form.
*
* Where possible, getAppLocales*() should be preferred over this API and
* all callsites should handle some form of "best effort" language
* negotiation to respect user preferences in case the use case does
* not have data for the first locale in the list.
*
* Example: "zh-Hans-HK"
*/
ACString getAppLocaleAsLangTag ();
pub unsafe fn GetAppLocaleAsBCP47(&self, _retval: &mut nsACString) -> nsresult
[src]
ACString getAppLocaleAsBCP47 ();
pub unsafe fn GetRequestedLocales(
&self,
aCount: *mut uint32_t,
aLocales: *mut *mut *const c_char
) -> nsresult
[src]
&self,
aCount: *mut uint32_t,
aLocales: *mut *mut *const c_char
) -> nsresult
/**
* Returns a list of locales that the user requested the app to be
* localized to.
*
* The result is an ordered list of locale IDs which should be
* used as a requestedLocales input list for language negotiation.
*
* Example: ["en-US", "de", "pl", "sr-Cyrl", "zh-Hans-HK"]
*/
void getRequestedLocales ([optional] out unsigned long aCount, [array, size_is (aCount), retval] out string aLocales);
pub unsafe fn GetRequestedLocale(&self, _retval: &mut nsACString) -> nsresult
[src]
/**
* Returns the top-requested locale from the user, or an empty string if none is set.
*/
ACString getRequestedLocale ();
pub unsafe fn SetRequestedLocales(
&self,
aRequested: *mut *const c_char,
aRequestedCount: uint32_t
) -> nsresult
[src]
&self,
aRequested: *mut *const c_char,
aRequestedCount: uint32_t
) -> nsresult
/**
* Sets a list of locales that the user requested the app to be
* localized to.
*
* The argument is an ordered list of locale IDs which should be
* used as a requestedLocales input list for language negotiation.
*
* The current implementation is limited to handle at most one
* locale passed to the API. In the future we'll transition to support
* whole fallback chain.
*
* If an empty list is passed, the list of requested locales will
* be picked from the operating system.
*
* Example: ["de"]
*/
void setRequestedLocales ([array, size_is (aRequestedCount)] in string aRequested, [optional] in unsigned long aRequestedCount);
pub unsafe fn GetAvailableLocales(
&self,
aCount: *mut uint32_t,
aLocales: *mut *mut *const c_char
) -> nsresult
[src]
&self,
aCount: *mut uint32_t,
aLocales: *mut *mut *const c_char
) -> nsresult
/**
* Returns a list of locales that the app can be localized to.
*
* The result is an unordered list of locale IDs which should be
* used as a availableLocales input list for language negotiation.
*
* Example: ["en-US", "de", "pl", "sr-Cyrl", "zh-Hans-HK"]
*/
void getAvailableLocales ([optional] out unsigned long aCount, [array, size_is (aCount), retval] out string aLocales);
pub unsafe fn GetIsAppLocaleRTL(&self, aIsAppLocaleRTL: *mut bool) -> nsresult
[src]
/**
* Returns whether the current app locale is RTL.
*/
readonly attribute boolean isAppLocaleRTL;
Methods from Deref<Target = nsISupports>
pub fn coerce<T: nsISupportsCoerce>(&self) -> &T
[src]
Cast this nsISupports
to one of its base interfaces.
pub unsafe fn QueryInterface(
&self,
uuid: &nsIID,
result: *mut *mut c_void
) -> nsresult
[src]
&self,
uuid: &nsIID,
result: *mut *mut c_void
) -> nsresult
void QueryInterface (in nsIIDRef uuid, [iid_is (uuid), retval] out nsQIResult result);
pub unsafe fn AddRef(&self) -> nsrefcnt
[src]
[noscript,notxpcom] nsrefcnt AddRef ();
pub unsafe fn Release(&self) -> nsrefcnt
[src]
[noscript,notxpcom] nsrefcnt Release ();
Trait Implementations
impl XpCom for mozILocaleService
[src]
const IID: nsIID
IID: nsIID = nsID(3263138179, 46219, 19738, [146, 215, 254, 184, 16, 111, 33, 45])
fn query_interface<T: XpCom>(&self) -> Option<RefPtr<T>>
[src]
Perform a QueryInterface call on this object, attempting to dynamically cast it to the requested interface type. Returns Some(RefPtr) if the cast succeeded, and None otherwise. Read more
impl RefCounted for mozILocaleService
[src]
unsafe fn addref(&self)
[src]
Increment the reference count.
unsafe fn release(&self)
[src]
Decrement the reference count, potentially freeing backing memory.
impl Deref for mozILocaleService
[src]
type Target = nsISupports
The resulting type after dereferencing.
fn deref(&self) -> &nsISupports
[src]
Dereferences the value.