-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: slangを使った多言語化 #285
fix: slangを使った多言語化 #285
Changes from 2 commits
43e3de5
be7d8a9
730b56e
950ece0
f4935d0
5853c27
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,7 +35,7 @@ Required only `--release` mode. | |
## How to use | ||
### Localizations | ||
```dart | ||
final l10n = L10n.of(context); | ||
final i18n = Translations.of(context); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
この JSONファイルの置き場所、生成ファイルのアウトプット場所や名前は設定ファイルを作成することでカスタマイズできます。
こちらも There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 詳しくありがとうございます!
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 承知いたしました! |
||
``` | ||
|
||
## FlutterFire Configure | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,5 @@ analyzer: | |
plugins: | ||
- custom_lint | ||
exclude: | ||
- "**/l10n/*.dart" | ||
- "**/gen/*.dart" | ||
- "**/firebase_options_*.dart" |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,27 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_gen/gen_l10n/app_localizations.dart'; | ||
|
||
import '../../gen/strings.g.dart'; | ||
|
||
extension ThemeModeExt on ThemeMode { | ||
String title(AppLocalizations l10n) { | ||
String title(Translations i18n) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 承知いたしました! |
||
switch (this) { | ||
case ThemeMode.system: | ||
return l10n.themeModeTitleSystem; | ||
return i18n.theme.mode.title.system; | ||
case ThemeMode.light: | ||
return l10n.themeModeTitleLight; | ||
return i18n.theme.mode.title.dark; | ||
case ThemeMode.dark: | ||
return l10n.themeModeTitleDark; | ||
return i18n.theme.mode.title.dark; | ||
} | ||
} | ||
|
||
String subtitle(AppLocalizations l10n) { | ||
String subtitle(Translations i18n) { | ||
switch (this) { | ||
case ThemeMode.system: | ||
return l10n.themeModeSubtitleSystem; | ||
return i18n.theme.mode.subtitle.system; | ||
case ThemeMode.light: | ||
return l10n.themeModeSubtitleLight; | ||
return i18n.theme.mode.subtitle.light; | ||
case ThemeMode.dark: | ||
return l10n.themeModeSubtitleDark; | ||
return i18n.theme.mode.subtitle.dark; | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
わかりやすいです!