GoogleSpreadSheetLocalize class
Annotation for automatic creation of multilingualization codes based on Google spreadsheets.
Prepare a Google Spreadsheet in advance by following the steps below.
- You can find the spreadsheet from template here on your Copy it to your Google Drive.
- You can copy from
File
->Make a copy
.
- You can copy from
- In the copied spreadsheet, click
File
->Share
->Share with others
. - In the
Share "(the name of the spreadsheet you created)"
window, changeGeneral access
toAnyone with the link
. - Copy the URL displayed in your browser (e.g.,
https://docs.google.com/spreadsheets/d/1bw7IXEr7BGkZ4U6on0OuF7HQkTMgDSm6u5ThpBkDPeo/edit#gid=551986808
) and paste it into this and paste it into the url field of this annotation.
You can use the functionality for multilingualization by creating a class that inherits from _$AppLocalize
with annotations as shown in the example below.
You can also explicitly update the translation by changing the number of version.
If version is not changed, the spreadsheet contents are cached.
Googleスプレッドシートを元に多言語化コードを自動作成するためのアノテーションです。
事前に下記の手順でGoogleスプレッドシートの準備を行います。
- こちらのテンプレートからスプレッドシートを自分のGoogleドライブにコピーします。
ファイル
->コピーの作成
からコピーが可能です。
- コピーしたスプレッドシート内で
ファイル
->共有
->他のユーザーと共有
をクリックします。 (作成したスプレッドシート名)を共有
ウィンドウ内で、一般的なアクセス
をリンクを知っている全員
に変更します。- ブラウザで表示されているURL(例:
https://docs.google.com/spreadsheets/d/1bw7IXEr7BGkZ4U6on0OuF7HQkTMgDSm6u5ThpBkDPeo/edit#gid=551986808
)をコピーしこのアノテーションのurlに貼り付けます。
下記の例のようにアノテーションを付与して_$AppLocalize
を継承したクラスを作成することで多言語化用の機能を利用することができます。
またversionの数を変更することにより明示的に翻訳内容を更新することができます。
versionを変更しない場合はスプレッドシートの内容がキャッシュされます。
@GoogleSpreadSheetLocalize(
"https://docs.google.com/spreadsheets/d/1bw7IXEr7BGkZ4U6on0OuF7HQkTMgDSm6u5ThpBkDPeo/edit#gid=551986808",
version: 1,
)
class AppLocalize extends _$AppLocalize {
}
final l = AppLocalize();
- Available Extensions
Constructors
-
GoogleSpreadSheetLocalize(List<
String> url, {required int version}) -
Annotation for automatic creation of multilingualization codes based on Google spreadsheets.
const
Properties
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