A Flutter plugin for retrieving the device locale information.

Overview

Build Status pub package License: MIT Flutter.io


A Flutter plugin for retrieving the device locale information.

Installation

Add this to your package's pubspec.yaml file:

dependencies:
  flutter_device_locale: <latest version>

Install packages from the command line (or from your editor):

flutter pub get

Import flutter_device_locale:

import 'package:flutter_device_locale/flutter_device_locale.dart';

Usage

Retrieve the current locale:

Locale locale = await DeviceLocale.getCurrentLocale();

Retrieve the preferred locales:

List<Locale> preferredLocales = await DeviceLocale.getPreferredLocales();

Issues

Please file any issues, bugs or feature request here.

License

This project is licensed under the MIT License

Author

This Flutter plugin is developed by Florin Bratan. You can contact me at [email protected]

Comments
  • Add Linux support

    Add Linux support

    std::setlocale is used to get the current locale. Since GNU/Linux and POSIX doesn't provide a standard API for getting the preferred languages, DeviceLocale.getPreferredLocales always returns the current locale. This is stated in the README. The code has been tested and works as expected.

    Screenshots: 2021-07-06 12-34-52

    opened by proninyaroslav 13
  • Web and desktop support?

    Web and desktop support?

    I try to use flutter_translate package which depend on this plugin, I hope it can support web and/or desktop support. Then a lot of devices can use this package.

    opened by liudonghua123 9
  • Unable to compile on iOS

    Unable to compile on iOS

    Hi I just noticed that, this plugin does not compile on flutter swift projects.

    
    Running pod install...                                              1.5s
    Running Xcode build...                                                  
                                                       
    Xcode build done.                                            2.7s
    Failed to build iOS app
    Error output from Xcode build:
    ↳
        ** BUILD FAILED **
    
    
    Xcode's output:
    ↳
        /Users/x/y/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_device_locale-0.3.4+1/ios/Classes/FlutterDeviceLocalePlugin.m:2:9: fatal error:
        'flutter_device_locale/flutter_device_locale-Swift.h' file not found
        #import <flutter_device_locale/flutter_device_locale-Swift.h>
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        1 error generated.
        note: Using new build system
        note: Planning build
        note: Constructing build description
    
    
    opened by piscis 7
  • Flutter Web Support

    Flutter Web Support

    Hi Florin,

    first of all, thanks for your awesome work. I am currently working on an app with i18n, for which I use flutter_translate. I also hope to support flutter web as soon as it becomes stable. So when I tried to run it with the current beta of flutter, I noticed that it doesn't work, because the LocalizationDelegate.create Call does not return, which itself fails due to the MethodChannel in this project.

    I've added some functionality to support Web. I roughly followed the guidelines for Federated Plugins, which the official plugins follow, but I did not split the code into separate sub-plugins per platform, as it is recommended, because I think it might be overkill for this plugin. But it can be migrated in such a structure quite easily from this point.

    I hope you like the modification. Feel free to ask, if there are any issues with my propsal :smile:

    Best regards Alex

    opened by avbk 3
  • Run Pod Install Failed

    Run Pod Install Failed

    When I Run Pod Install the following issue: (use latest version 0.3.4+1)

    • flutter_device_locale does not specify a Swift version and none of the targets (Runner) integrating it have the SWIFT_VERSION attribute set. Please contact the author or set the SWIFT_VERSION attribute in at least one of the targets that integrate this pod.
    bug 
    opened by quangphananh 3
  • Move Android source code to match new package name

    Move Android source code to match new package name

    The Android package name in AndroidManifest.xml for this package changed between 0.3.1 and 0.3.2. This has caused a problem where 0.3.2 can no longer be installed through pub get. The cause of this issue appears to be the directory structure no longer matches the package name, and so the installation fails.

    This PR simply moves the Android source file into a directory structure that matches the new package name.

    This PR can be verified with the following steps:

    1. Adding flutter_device_locale: 0.3.2 to pubspec.yml in an existing Flutter project. Installation of the package will fail.

    2. Modify pubspec.yml to install from my fork:

      flutter_device_locale:
        git:
          url: https://github.com/MichaelMarner/flutter_device_locale.git
          ref: package-change
    

    Installation will succeed.

    Probably worth mentioning I'm on the Flutter dev channel.

    Closes #1

    opened by MichaelMarner 2
  • Travis shall ignore Flutter-Web-Warning

    Travis shall ignore Flutter-Web-Warning

    Since Flutter Web is currently not available in the stable branch, the Travis Build Job fails. Therefore we ignore the error until Flutter Web becomes stable eventually.

    opened by avbk 1
  • Installing 0.3.2 fails looking for a Kotlin implementation

    Installing 0.3.2 fails looking for a Kotlin implementation

    Hi there

    I'm a user of flutter_translate, which depends on this package. Since 0.3.2, installation of this package has failed with the following error:

    Couldn't read file LocalFile: '~/.pub-cache/hosted/pub.dartlang.org/flutter_device_locale-0.3.2/android/src/main/kotlin/com/jesway/flutter_device_locale/FlutterDeviceLocalePlugin.kt' even though it exists. Please verify that this file has read permission and try again.
    exit code 1
    

    Explicitly requiring 0.3.1 makes this error go away.

    There is a similar issue with another package here:

    https://github.com/flutter/flutter/issues/42923

    Thanks

    opened by MichaelMarner 1
  • Remove deprecated setting android.enableR8=true

    Remove deprecated setting android.enableR8=true

    Android Studio complains about this line during Gradle sync.

    FYI There is a pull request for Flutter, also a Stack Overflow question:

    https://github.com/flutter/flutter/pull/63339

    https://stackoverflow.com/questions/60397617/progruard-and-r8-being-deprecated-android-studio-3-6

    If you have android.enableR8 = true in your gradle.properties, remove it as R8 it the default tooling and the android.enableR8 setting itself is deprecated, causing these deprecation warnings.

    opened by nohli 0
Owner
Florin Bratan
Florin Bratan
A cross platform plugin for modifying calendars on the user's device

Device Calendar Plugin If you're upgrading to v4.0.0, your previous code will need to be modified (slightly) otherwise it will not run after update. S

Built to Roam 209 Nov 16, 2022
A flutter app to store personal information about accesses, usernames and passwords

pass_reminder My very first Flutter project. An app to store personal information about accesses, usernames and passwords. Personal use only. Images A

Igor Ribeiro Silva 0 Oct 24, 2021
Platform to post/say something without sharing personal information.

Anon is an Open Source Application where it's users will be able to share their thoughts without their identity being revealed i.e Anonymous. When the

Ismael Shakverdiev 18 Sep 13, 2022
A coronavirus statistics, news and general information app with a symptom checker. πŸš€

Corona Spectator Corona Spectator is a coronavirus statistics and news app that has real time global COVID-19 stats. It includes useful tips to help g

Carlton Aikins 26 Oct 8, 2022
A platform to share crowdsourced information of plasma donors, hospital beds and oxygen suppliers to help COVID patients

India Beats Covid This is an effort to bring together and verify all the contacts of the needed resources for people fighting COVID-19 in our country

Pawan Kumar 131 Sep 13, 2022
Android application that manage all the information of Pandemic Covid-19 in Vietnam.

COVID-19 Health-care Management Android application that manage all the information of Pandemic Covid-19 in Vietnam. Overview Here is the detail and t

null 0 Dec 4, 2021
Aris scpubliccode - Ricoh Theta Sc2 Api Tests Using Public Information

RICOH THETA SC2 API Tests Using Public Information RICOH THETA API requests for

Behruz Hurramov 1 Jan 9, 2022
Using weather application and get weather information daily and daily

Aris Weather Getting Started $ git clone https://github.com/ariscybertech/aris_weather.git $ flutter packages get Run the application and enjoy ?? ☺️

Behruz Hurramov 4 Jan 17, 2022
Simple weather app to get weather information.

β›… Weather Forecast Simple weather app to get weather information. It fetches the weather for the location in the local database when you launch the ap

Yigit Esmen 9 Nov 11, 2022
App for getting weather information at any location.

weather_app A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if t

Rohit Krishna 10 Dec 30, 2022
πŸš€ Full-Stack Flutter application, encoded using Dart. Utilizes native device features πŸ“· and stores user data on a local SQFLite database. βœ”

great_places_app A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started

Soumyadeep Das 2 Jan 24, 2022
Battery+ is an open source battery info and device info for Android.

Battery+ Battery+ is an open source battery info and device info for Android.

Keshav Pratap K 1 Sep 26, 2022
The Device Fingerprint tool collects thorough insight about the devices associated to a user.

The Device Fingerprint tool collects thorough insight about the devices associated to a user. Account takeovers and multiple account signups, payments can easily be avoided by applying the Device Fingerprinting module.

Shahin Sefidgaran 6 Nov 28, 2022
Flutter Music Player - First Open Source Flutter based material design music player with audio plugin to play local music files.

Flutter Music Player First Open Source Flutter based Beautiful Material Design Music Player(Online Radio will be added soon.) Demo App Play Store BETA

Pawan Kumar 1.5k Jan 8, 2023
A Flutter plugin for the Google Mobile Ads SDK

A Flutter plugin for the Google Mobile Ads SDK

Google Ads 251 Jan 2, 2023
Flutter plugin that allows users to create TextAvatar easily!

Colorize Text Avatar Colorize Text Avatar is a package to generate avatar based on your user initials. It supports to generate avatars based on your s

Deniz Γ‡olak 17 Dec 14, 2022
Official plugin for using Thepeer SDK with flutter https://thepeer.co

Flutter Thepeer This package makes it easy to use the Thepeer in a flutter project. ?? Screen Shots ?? How to Use plugin ThePeer Send Launch ThepeerSe

The Peer 23 Dec 27, 2022
This plugin allows Flutter desktop apps to resizing and repositioning the window.

window_manager This plugin allows Flutter desktop apps to resizing and repositioning the window. window_manager Platform Support Quick Start Installat

LeanFlutter 346 Jan 3, 2023
A cross-platform (Android/Windows/macOS/Linux) USB plugin for Flutter

quick_usb A cross-platform (Android/Windows/macOS/Linux) USB plugin for Flutter Usage List devices List devices with additional description Get device

Woodemi Co., Ltd 39 Oct 1, 2022