npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@capacitor-trancee/app-language

v1.3.3

Published

Per-app language preferences

Downloads

6

Readme

@capacitor-trancee/app-language

Per-app language preferences

Reference

Android

Per-app language preferences

iOS

How to support per-app language settings in your app

Install

npm install @capacitor-trancee/app-language
npx cap sync

API

initialize(...)

initialize(options?: InitializeOptions | undefined) => Promise<void>

Initializes the plugin and injects dependencies.

Only available for Web.

| Param | Type | | ------------- | --------------------------------------------------------------- | | options | InitializeOptions |

Since: 1.1.0


getApplicationLocales()

getApplicationLocales() => Promise<LocalesResult>

Returns the UI locales for the calling app.

Returns: Promise<LocalesResult>

Since: 1.0.0


setApplicationLocales(...)

setApplicationLocales(options: LocalesOptions) => Promise<void>

Sets the UI locales for the calling app.

Note: Pass an empty locales list to reset to the system locale.

Only available for Android.

| Param | Type | | ------------- | --------------------------------------------------------- | | options | LocalesOptions |

Since: 1.0.0


resetApplicationLocales()

resetApplicationLocales() => Promise<void>

Resets the app locale to the system locale.

Only available for Android.

Since: 1.0.0


getSystemLocales()

getSystemLocales() => Promise<LocalesResult>

Returns the current system locales, ignoring app-specific overrides.

Returns: Promise<LocalesResult>

Since: 1.0.0


getOverrideLocaleConfig()

getOverrideLocaleConfig() => Promise<LocaleConfigResult>

Returns the override LocaleConfig for the calling app.

Only available for Android (>= 34) and later.

Returns: Promise<LocaleConfigResult>

Since: 1.0.0


setOverrideLocaleConfig(...)

setOverrideLocaleConfig(options: LocaleConfigOptions) => Promise<void>

Sets the override LocaleConfig for the calling app.

Note: Only the app itself with the same user can override its own LocaleConfig.

Only available for Android (>= 34) and later.

| Param | Type | | ------------- | --------------------------------------------------------- | | options | LocalesOptions |

Since: 1.0.0


openSettings()

openSettings() => Promise<void>

Shows settings to allow configuration of per application locale.

Only available for iOS and Android (>= 33) and later.

Since: 1.0.0


addListener('languageChanged', ...)

addListener(eventName: 'languageChanged', listenerFunc: LanguageChangedListener) => Promise<PluginListenerHandle>

Called when the user's preferred language changes.

Only available for Web.

| Param | Type | | ------------------ | --------------------------------------------------------------------------- | | eventName | 'languageChanged' | | listenerFunc | LanguageChangedListener |

Returns: Promise<PluginListenerHandle>

Since: 1.1.0


removeAllListeners()

removeAllListeners() => Promise<void>

Remove all listeners for this plugin.

Only available for Web.

Since: 1.1.0


Interfaces

InitializeOptions

| Prop | Type | Description | Since | | ---------- | ----------------- | --------------------------------------------- | ----- | | i18n | I18n | The instance of i18n. Only available for Web. | 1.1.0 |

PluginListenerHandle

| Prop | Type | | ------------ | ----------------------------------------- | | remove | () => Promise<void> |

LanguageChangedEvent

| Prop | Type | Description | Since | | ------------- | --------------------- | ------------------------------------------------------------------------ | ----- | | locales | string[] | Returns an array of strings representing the user's preferred languages. | 1.1.0 |

Type Aliases

LocalesResult

{ /** * Returns the locales supported by the specified application. * * @since 1.0.0 */ locales?: string[]; }

LocalesOptions

{ /** * The list of locales. * * @since 1.0.0 */ locales?: string[]; }

LocaleConfigResult

LocalesResult | { /** * Get the status of reading the resource file where the LocaleConfig was stored. * * @since 1.0.0 */ status: Status; }

LocaleConfigOptions

LocalesOptions

LanguageChangedListener

Callback to receive when the user's preferred language changes.

(event: LanguageChangedEvent): void

Enums

Status

| Members | Value | Description | Since | | -------------------- | -------------- | ---------------------------------------------------------------------------------------- | ----- | | SUCCESS | 0 | Succeeded reading the LocaleConfig structure stored in an XML file. | 1.0.0 | | NOT_SPECIFIED | 1 | No android:localeConfig tag on pointing to an XML file that stores the LocaleConfig. | 1.0.0 | | PARSING_FAILED | 2 | Malformed input in the XML file where the LocaleConfig was stored. | 1.0.0 |