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

パッケージ詳細v6.0.0

i18n_extension_core

Dart専用の翻訳および国際化(i18n)パッケージ、Dart拡張機能付き。大規模プロジェクトから小規模プロジェクトまで使いやすく、簡単です。

AndroidiOSLinuxmacOSWebWindows
30日間ダウンロード
6.9万
いいね数
5
Pub ポイント
140

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

flutter pub add i18n_extension_core

パッケージ概要

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

Flutterアプリにおける翻訳および国際化を簡素化するためのDart専用パッケージです。最小限のボイラープレートで、ローカライゼーションを簡単に実現する直感的なDart拡張機能を提供します。小規模から大規模なプロジェクトまで対応可能で、Android、iOS、Web、デスクトップなど複数のプラットフォームをサポートしています。シンプルな構文と構造化されたキー値ペアを使用して、開発者が翻訳を効率的に管理でき、ローカライズされた文字列の読みやすさと保守性を高めます。

用途

  • シンプルなアプリのローカライゼーション
  • 大規模なマルチリンガルアプリケーション
  • クロスプラットフォームのFlutterアプリ
  • 動的文字列フォーマット
  • 既存のコードベースとの簡単な統合
  • 翻訳付きの迅速なプロトタイピング

主な機能

  • 簡潔な構文用のDart拡張
  • 最小限のセットアップとボイラープレート
  • プラットフォームに依存しない翻訳をサポート
  • 組み込み文字列インターポレーション
  • 拡張可能なキー値翻訳システム
  • 軽量で高速

適している対象

  • i18n 初心者の Flutter 開発者
  • 複数の言語を管理するチーム
  • 迅速なローカライゼーションを必要とするプロジェクト
  • 純粋なDartソリューションを好む開発者
  • グローバルなターゲット層向けのアプリ
  • 小規模から企業レベルのアプリ

注意事項

  • 翻訳管理用の組み込みUIはありません
  • 手動での翻訳ファイルのメンテナンスが必要です
  • 完全なフレームワークと比べて、IDEのサポートが限られている
  • 追加の論理なしでは実行時言語切り替えに適していない
  • 翻訳ファイル生成ツールを含んでいません
  • キーに一貫した命名規則を使用するのが最適です

元の README

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

pub package

i18n_extension_core

This is the core Dart-only package for the i18n_extension package.

In your Flutter app:

  • Do NOT include this core package directly.

    Instead, go to the i18n_extension package which already exports this core code, plus provides Flutter related code like the I18n widget that you must use to wrap your widget tree.

In your Dart server or Dart-only code:

  • If you are working on a Dart server-side application (backend) using frameworks such as Serverpod, Dart Frog, or Shelf, or developing a Dart-only package that does not rely on Flutter, you can use this package directly.:

    import 'package:i18n_extension_core/i18n_extension_core.dart';
    
    extension Localization on String {
      static var t = Translations.byText("en_us") + {"en_us":"Hello", "pt_br":"Hola"};
      String get i18n => localize(this, t);
    }
    
    DefaultLocale.set("es_ES");
    expect("Hello".i18n, "Hola");
    

    Note: One key use case is translating exception messages from the backend to the frontend. For example, if the backend throws an exception like: MyException('The password you typed is invalid'.i18n) it will automatically appear on the frontend as: MyException('La contraseña que ingresaste no es válida') if the user's device language is set to Spanish.

Documentation

Go to i18n_extension to read the docs.

There are only 2 differences when using this package directly:

  • Here you don't have access to the I18n widget, which is a Flutter widget.

  • The way to set the default locale is different. Instead of using the I18n widget, you must use the DefaultLocale.set() static method, like in the example above.


By Marcelo Glasberg

glasberg.dev
github.com/marcglasberg
linkedin.com/in/marcglasberg/
twitter.com/glasbergmarcelo
stackoverflow.com/users/3411681/marcg
medium.com/@marcglasberg

My article in the official Flutter documentation:

The Flutter packages I've authored:

My Medium Articles:

カテゴリー

依存関係

依存関係一覧 1 件

ソースリポジトリ

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

ランキング