
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
capacitor-app-language
Advanced tools
Per-app language preferences
https://developer.android.com/guide/topics/resources/app-languages
npm install @capacitor-community/app-language
npx cap sync
initialize(...)
getApplicationLocales()
setApplicationLocales(...)
resetApplicationLocales()
getSystemLocales()
getOverrideLocaleConfig()
setOverrideLocaleConfig(...)
openSettings()
addListener('languageChanged', ...)
removeAllListeners()
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() => Promise<LocalesResult>
Returns the UI locales for the calling app.
Returns: Promise<LocalesResult>
Since: 1.0.0
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() => Promise<void>
Resets the app locale to the system locale.
Only available for Android.
Since: 1.0.0
getSystemLocales() => Promise<LocalesResult>
Returns the current system locales, ignoring app-specific overrides.
Returns: Promise<LocalesResult>
Since: 1.0.0
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(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() => 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(eventName: 'languageChanged', listenerFunc: LanguageChangedListener) => Promise<PluginListenerHandle> & PluginListenerHandle
Called when the user's preferred language changes.
Only available for Web.
Param | Type |
---|---|
eventName | 'languageChanged' |
listenerFunc | LanguageChangedListener |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
Since: 1.1.0
removeAllListeners() => Promise<void>
Remove all listeners for this plugin.
Only available for Web.
Since: 1.1.0
Prop | Type | Description | Since |
---|---|---|---|
i18n | I18n | The instance of i18n. Only available for Web. | 1.1.0 |
Prop | Type |
---|---|
remove | () => Promise<void> |
Prop | Type | Description | Since |
---|---|---|---|
locales | string[] | Returns an array of strings representing the user's preferred languages. | 1.1.0 |
{ /** * Returns the locales supported by the specified application. * * @since 1.0.0 */ locales?: string[]; }
{ /** * The list of locales. * * @since 1.0.0 */ locales?: string[]; }
LocalesResult | { /** * Get the status of reading the resource file where the
LocaleConfig
was stored. * * @since 1.0.0 */ status: Status; }
Callback to receive when the user's preferred language changes.
(event: LanguageChangedEvent): void
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 |
FAQs
Per-app language preferences
The npm package capacitor-app-language receives a total of 0 weekly downloads. As such, capacitor-app-language popularity was classified as not popular.
We found that capacitor-app-language demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.