Socket
Book a DemoInstallSign in
Socket

capacitor-app-language

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

capacitor-app-language

Per-app language preferences

1.2.1
unpublished
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

@capacitor-community/app-language

Per-app language preferences

https://developer.android.com/guide/topics/resources/app-languages

Install

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

API

initialize(...)

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

Initializes the plugin and injects dependencies.

Only available for Web.

ParamType
optionsInitializeOptions

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.

ParamType
optionsLocalesOptions

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.

ParamType
optionsLocalesOptions

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> & PluginListenerHandle

Called when the user's preferred language changes.

Only available for Web.

ParamType
eventName'languageChanged'
listenerFuncLanguageChangedListener

Returns: Promise<PluginListenerHandle> & 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

PropTypeDescriptionSince
i18nI18nThe instance of i18n. Only available for Web.1.1.0

PluginListenerHandle

PropType
remove() => Promise<void>

LanguageChangedEvent

PropTypeDescriptionSince
localesstring[]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

MembersValueDescriptionSince
SUCCESS0Succeeded reading the LocaleConfig structure stored in an XML file.1.0.0
NOT_SPECIFIED1No android:localeConfig tag on pointing to an XML file that stores the LocaleConfig.1.0.0
PARSING_FAILED2Malformed input in the XML file where the LocaleConfig was stored.1.0.0

Keywords

capacitor

FAQs

Package last updated on 11 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.