capacitor-device-locale
TypeScript icon, indicating that this package has built-in type declarations

0.0.9 • Public • Published


Capacitor Device Locale

Capacitor plugin for getting native device locale

Introduction

The Capacitor Device Locale package is a comprehensive solution that enables developers to effortlessly obtain the device locale information from both iOS and Android platforms. With its robust capabilities, this package simplifies the process of retrieving locale data. By integrating this package into your application, you can efficiently access and utilize device-specific locale information.

Install

npm install capacitor-device-locale
npx cap sync

API

Device locale plugin.

getDeviceLocale()

getDeviceLocale() => Promise<DeviceLocale>

Get the device locale.

Returns: Promise<DeviceLocale>


Interfaces

DeviceLocale

Prop Type Description
regionCode string The region code of the device locale. Example: "US"
country string The country of the device locale. Example: "United States"
languageCode string The language code of the device locale. Example: "en"
language string The language of the device locale. Example: "English"
currencySymbol string The symbol used for the currency in the device locale. Example: "$"
currencyCode string The currency code of the device locale. Example: "USD"
currencyName string The name of the currency in the device locale. Example: "US Dollar"
timezone string The timezone of the device locale. Example: "America/New_York"

Usage

import { getDeviceLocale, DeviceLocale } from 'capacitor-device-locale';

async function getDeviceLocaleInformation() {
  try {
    const deviceLocale: DeviceLocale = await getDeviceLocale();
    console.log('Device Locale:', deviceLocale);
    // Perform operations with the device locale
  } catch (error) {
    console.error('Error retrieving device locale:', error);
    // Handle error
  }
}

getDeviceLocaleInformation();

/capacitor-device-locale/

    Package Sidebar

    Install

    npm i capacitor-device-locale

    Weekly Downloads

    0

    Version

    0.0.9

    License

    MIT

    Unpacked Size

    22.6 kB

    Total Files

    23

    Last publish

    Collaborators

    • sarifmia