パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v2.0.0

locale_plus

LocalePlus を使用すると、Flutter アプリでネイティブデバイスのロケールデータに簡単にアクセスできます。言語、国コード、タイムゾーン、数値フォーマットの設定が含まれます。

AndroidiOS
30日間ダウンロード
6520
いいね数
33
Pub ポイント
140

パッケージをインストール

flutter pub add locale_plus

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

LocalePlus は、言語、国コード、タイムゾーン、数値フォーマットの好みなど、ネイティブデバイスのロケール情報をシームレスにアクセスできるFlutterパッケージです。複雑な設定を必要とせずにシステムレベルのロケールデータを取得することで、ローカライゼーションを簡素化します。動的なコンテンツレンダリング、日付/時刻表示、通貨形式化に正確な地域設定が必要なアプリに最適です。このパッケージはFlutterの国際化フレームワークとスムーズに統合され、AndroidおよびiOSプラットフォームの両方をサポートしています。

用途

  • ユーザーの地域に基づくダイナミックUI
  • ローカライズされた日付と時刻の表示
  • 数値と通貨の書式設定
  • マルチ言語アプリのサポート
  • ロケールによるアプリ動作の調整
  • 地域設定を通じたアクセシビリティの向上

主な機能

  • デバイス固有のロケールデータを取得します
  • 言語、国、タイムゾーン、フォーマットをサポート
  • 最小限のセットアップで簡単なAPI
  • クロスプラットフォーム(Android および iOS)
  • 軽量で依存関係なし
  • ユーザーの好みのロケールを自動検出

適している対象

  • 地域カスタマイズを必要とするアプリ
  • 国際化アプリケーション
  • 金融または旅行アプリ
  • ローカライゼーションのニーズを持つユーザー向けアプリ
  • 迅速なロケールアクセスを求める開発者
  • Flutterのi18n機能を使用するプロジェクト

注意事項

  • デバイスのシステム設定に依存しています
  • 翻訳文字列を処理しません
  • ロケールデータの読み取りに制限
  • 組み込みのフォールバックメカニズムなし
  • ロケールの変更を手動で処理する必要があります
  • 単独では完全なi18nワークフローには適していません

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

Locale Plus

LocalePlus allows easy access to native device locale data in Flutter apps. Includes language, country code, time zone, and number formatting preferences.

Table of Content

Overview

LocalePlus is a Flutter package that allows developers to easily retrieve data from the native device locale settings. With LocalePlus, developers can access information such as the device's language, country code, and time zone, as well as the device's number formatting preferences such as grouping and decimal separator. This makes it easy to build internationalized apps that provide a personalized experience for each user. Whether you're building a financial app that needs to display numbers in the user's local format or a social media app that needs to display timestamps in the user's time zone, LocalePlus has you covered. With a simple and intuitive API, LocalePlus is the perfect tool for any Flutter developer looking to add localization to their app.

Requirements

  • Dart sdk: ">=3.10.0 <4.0.0"
  • Flutter: ">=3.38.0"
  • Android: minSdkVersion 16
  • iOS 13.0+

The iOS plugin supports both Swift Package Manager and CocoaPods.

Installation

with Flutter:

$ flutter pub add locale_plus

This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get):

dependencies:
  locale_plus: ^2.0.0

Usage

Patch the locales with the users' group and decimal seperators

This function patches all locales in flutter, so that you can use the decimal seperator and group seperator from numberFormatSymbols after the patch is complete. The patchNumberSeperators function patches the locales on android and ios. The shouldPatchForSamsungKeyboard can be enabled, to patch for Samsung keyboards on android phones (they only allow for a . as input). It is safe to call on MacOS, Windows, Linux and web, but it does not patch the locales.

import 'package:locale_plus/locale_plus.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await PatchAllLocales.patchNumberSeperators(
    shouldPatchForSamsungKeyboard: true,
  );
  runApp(const MyApp());
}

Get if the user is using a samsung keyboard

final decimalSeparator = await LocalePlus().isUsingSamsungKeyboard();

Get Decimal & Grouping Separator

final decimalSeparator = await LocalePlus().getDecimalSeparator();
final groupingSeparator = await LocalePlus().getGroupingSeparator();

Get Language & Region Code

final regionCode = await LocalePlus().getRegionCode();
final languageCode = await LocalePlus().getLanguageCode();

Get Seconds from GMT

final secondsFromGMT = await LocalePlus().getSecondsFromGMT();

Is Device Using 24 hour time and Current Locale AM PM Symbols

final is24HourTime = await LocalePlus().is24HourTime();
final amSymbol = await LocalePlus().getAmSymbol();
final pmSymbol = await LocalePlus().getPmSymbol();

Is Device Using Metric System

final usesMetricSystem = await LocalePlus().usesMetricSystem();

Get TimeZone Identifier

final timeZoneIdentifier = await LocalePlus().getTimeZoneIdentifier();

Get First Day Of Week

final firstDayOfWeek = await LocalePlus().getFirstDayOfWeek();

Get Date format pattern

final dateFormatPattern = await LocalePlus().getDateFormatPattern();

Author

Gökberk Bardakçı, Uygar İşiçelik

Contributors

Bent Engbers, Renat Shakhmatov, Giovanni Lattanzio, Gökhan Çavuş

License

LocalePlus is available under the MIT license. See the LICENSE file for more info.

カテゴリー

依存関係

依存関係一覧 3 件

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。