Skip to content

Commit

Permalink
add Language Setting
Browse files Browse the repository at this point in the history
  • Loading branch information
hoosong0235 authored and sboh1214 committed Aug 17, 2023
1 parent 3b8798b commit f454d63
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions assets/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@
"deleted_account": "This is the deleted account."
},
"settings": {
"language": "Language",
"current_language": "English",
"send_error_log": "Send error log",
"send_error_log_desc": "Automatically collect logs without user reporting",
"send_anonymously": "Send anonymously",
Expand Down
2 changes: 2 additions & 0 deletions assets/translations/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@
"deleted_account": "삭제된 계정입니다."
},
"settings": {
"language": "언어",
"current_language": "한국어",
"send_error_log": "오류 로그 전송",
"send_error_log_desc": "사용자의 제보 없이 자동으로 오류를 수집합니다.",
"send_anonymously": "익명으로 전송",
Expand Down
21 changes: 21 additions & 0 deletions lib/pages/settings_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,27 @@ class SettingsPage extends StatelessWidget {
padding: const EdgeInsets.all(16.0),
child: Column(
children: [
ListTile(
title: Text(
"settings.language".tr(),
style: bodyBold,
),
subtitle: Text(
"settings.current_language".tr(),
style: bodyRegular,
),
trailing: PlatformSwitch(
value:
EasyLocalization.of(context)?.currentLocale == Locale("en"),
onChanged: (value) {

Check warning on line 36 in lib/pages/settings_page.dart

View check run for this annotation

Codecov / codecov/patch

lib/pages/settings_page.dart#L36

Added line #L36 was not covered by tests
if (value) {
EasyLocalization.of(context)?.setLocale(Locale('en'));

Check warning on line 38 in lib/pages/settings_page.dart

View check run for this annotation

Codecov / codecov/patch

lib/pages/settings_page.dart#L38

Added line #L38 was not covered by tests
} else {
EasyLocalization.of(context)?.setLocale(Locale('ko'));

Check warning on line 40 in lib/pages/settings_page.dart

View check run for this annotation

Codecov / codecov/patch

lib/pages/settings_page.dart#L40

Added line #L40 was not covered by tests
}
},
),
),
ListTile(
title: Text(
"settings.send_error_log".tr(),
Expand Down

0 comments on commit f454d63

Please sign in to comment.