Skip to content

A Flutter package to read and return the set device locales

License

Notifications You must be signed in to change notification settings

ideologist/flutter-devicelocale

 
 

Repository files navigation

devicelocale

Gets the device locale data, independent of the app locale settings.

Usage

import 'package:devicelocale/devicelocale.dart';

then

List languages = await Devicelocale.preferredLanguages;
String locale = await Devicelocale.currentLocale;

this should return a list of the preferred/current language locales setup on the device, with the current one being the first in the list or just the currently set device locale.

iOS

When first created this was a Swift based plugin, but due to these issues the Swift code has been removed and it now uses a simple Objective C call.

Updates

  • Sep 2019 0.2.0 Updated Android following feedback from https://github.com/huzhirento . Fallback to the currentLocale when attempting to get a list of locales fro Android 7 and below as the getLocales() call is a feature of API 24 and failed for Android 7 and below.

Getting Started

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

About

A Flutter package to read and return the set device locales

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Dart 47.6%
  • Ruby 34.7%
  • Objective-C 11.8%
  • Java 5.9%