YamlLocalize class

This is an annotation for automatically generating multilingual code from a Yaml file.

Create the Yaml file in the specified format and place it at the path specified in path. Call the key specified in key to get translations in languages such as ja_JP and en_US.

By adding an annotation and creating a class that inherits from _$AppLocalize, as shown in the example below, you can use the localization feature.

You can also explicitly update the translation by changing the number of version.

Yamlファイルを元に多言語化コードを自動作成するためのアノテーションです。

事前のフォーマットでYamlを作成しpathに指定したパスに配置します。 keyに指定したキーを呼び出し、ja_JPen_USに指定した言語での翻訳を取得します。

localize:
  - key: "hello"
    ja_JP: "こんにちは"
    en_US: "Hello"
  - key: "world"
    ja_JP: "世界"
    en_US: "World"

下記の例のようにアノテーションを付与して_$AppLocalizeを継承したクラスを作成することで多言語化用の機能を利用することができます。

またversionの数を変更することにより明示的に翻訳内容を更新することができます。

@YamlLocalize(version: 1)
class AppLocalize extends _$AppLocalize {
}

final l = AppLocalize();

Constructors

YamlLocalize({required int version, List<String> path = const ["localize.base.yaml", "localize.app.yaml"]})
This is an annotation for automatically generating multilingual code from a Yaml file.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
path List<String>
The path to the Yaml file.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
version int
Yaml Version.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited