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

パッケージ詳細v0.4.1

intl_generator

国際化/ローカライズされたメッセージ、日付および数値のフォーマットと解析、双方向テキスト、その他の国際化に関する問題に対処するためのコードを含みます。

AndroidiOSmacOSWindowsLinux
30日間ダウンロード
1630
いいね数
25
Pub ポイント
110

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

flutter pub add intl_generator

パッケージ概要

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

intl_generator パッケージは、Flutter アプリにおける国際化の処理に向けたコード生成ツールを提供します。ローカライズされたメッセージ、日付および数値のフォーマット、パース、および双方向テキストのレンダリングをサポートしています。メッセージファイルからDartコードを生成することで、実行時オーバーヘッドなしに効率的かつ型安全なローカライズが可能になります。このパッケージは intl ライブラリとシームレスに統合されており、複数の言語やプラットフォーム間での翻訳管理を容易にします。

用途

  • .arb ファイルからローカライズされた文字列を生成する
  • ロケールごとの日付と数値の書式設定
  • 右から左への言語をサポート
  • マルチリンガルアプリコンテンツの管理
  • 翻訳ワークフローの自動化

主な機能

  • ARB ファイルからのコード生成
  • 型安全なローカリゼーション
  • 複数形の組み込みサポート
  • intl ライブラリとの統合
  • プラットフォームに依存しないローカリゼーション

適している対象

  • グローバルなユーザーをターゲットにしたFlutterアプリ
  • 複数言語の翻訳を管理するチーム
  • ハイパフォーマンスローカリゼーションを必要とするプロジェクト
  • メッセージ管理に ARB を使用する開発者
  • 一貫した日付/数値フォーマットが必要なアプリ

注意事項

  • ARB ファイルの設定が必要です
  • コード生成のビルドステップが必要です
  • 制限された実行時カスタマイズ
  • intl ライブラリに依存しています
  • 動的言語切り替えには適していません

元の README

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

Intl_generator

This is a fork of intl_translation to have an up to date version.

If you prefer having translations as part of your build_runner process or need to support flavors, please check intl_flavors

This package provides message extraction and code generation from translated messages for the Intl package. It's a separate package so as to not require a dependency on analyzer for all users.

Extracting And Using Translated Messages

When your program contains messages that need translation, these must be extracted from the program source, sent to human translators, and the results need to be incorporated.

To extract messages, run the extract_to_arb.dart program.

  pub run intl_generator:extract_to_arb --output-dir=target/directory
      my_program.dart more_of_my_program.dart

This will produce a file intl_messages.arb with the messages from all of these programs. This is an ARB format file which can be used for input to translation tools like Localizely or (the deprecated) Google Translator Toolkit. The resulting translations can be used to generate a set of libraries using the generate_from_arb.dart program.

This expects to receive a series of files, one per locale.

pub run intl_generator:generate_from_arb --generated-file-prefix=<prefix>
    <my_dart_files> <translated_ARB_files>

This will generate Dart libraries, one per locale, which contain the translated versions. Your Dart libraries can import the primary file, named <prefix>messages_all.dart, and then call the initialization for a specific locale. Once that's done, any Intl.message calls made in the context of that locale will automatically print the translated version instead of the original.

import "my_prefix_messages_all.dart";
...
initializeMessages("dk").then(printSomeMessages);

Once the Future returned from the initialization call completes, the message data is available.

カテゴリー

依存関係

依存関係一覧 7 件

ソースリポジトリ

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