0.0.9 • Published 2 years ago

capacitor-device-locale v0.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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

PropTypeDescription
regionCodestringThe region code of the device locale. Example: "US"
countrystringThe country of the device locale. Example: "United States"
languageCodestringThe language code of the device locale. Example: "en"
languagestringThe language of the device locale. Example: "English"
currencySymbolstringThe symbol used for the currency in the device locale. Example: "$"
currencyCodestringThe currency code of the device locale. Example: "USD"
currencyNamestringThe name of the currency in the device locale. Example: "US Dollar"
timezonestringThe 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();
0.0.9

2 years ago

0.0.4

2 years ago

0.0.1

2 years ago