1
0
forked from baron/baron-sso

Merge feature/i18n into dev (userfront only)

This commit is contained in:
Lectom C Han
2026-02-12 21:53:42 +09:00
55 changed files with 3982 additions and 1104 deletions

View File

@@ -5,6 +5,7 @@ import 'package:userfront/i18n.dart';
import '../../../../core/notifiers/auth_notifier.dart';
import '../../../../core/services/auth_token_store.dart';
import '../../../../core/ui/layout_breakpoints.dart';
import '../../../../core/widgets/language_selector.dart';
import '../../data/models/user_profile_model.dart';
import '../../domain/notifiers/profile_notifier.dart';
@@ -235,7 +236,6 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
content: Text(
tr(
'msg.userfront.profile.phone.code_sent',
fallback: '인증번호가 전송되었습니다.',
),
),
),
@@ -249,7 +249,6 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
content: Text(
tr(
'msg.userfront.profile.phone.send_failed',
fallback: '전송 실패: {{error}}',
params: {'error': e.toString()},
),
),
@@ -275,7 +274,7 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
tr('msg.userfront.profile.phone.verified', fallback: '인증되었습니다.'),
tr('msg.userfront.profile.phone.verified'),
),
),
);
@@ -291,7 +290,6 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
content: Text(
tr(
'msg.userfront.profile.phone.verify_failed',
fallback: '인증 실패: {{error}}',
params: {'error': e.toString()},
),
),
@@ -311,7 +309,6 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
setState(
() => _passwordError = tr(
'msg.userfront.profile.password.current_required',
fallback: '현재 비밀번호를 입력해 주세요.',
),
);
return;
@@ -320,7 +317,6 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
setState(
() => _passwordError = tr(
'msg.userfront.profile.password.new_required',
fallback: '새 비밀번호를 입력해 주세요.',
),
);
return;
@@ -329,7 +325,6 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
setState(
() => _passwordError = tr(
'msg.userfront.profile.password.mismatch',
fallback: '새 비밀번호가 일치하지 않습니다.',
),
);
return;
@@ -354,7 +349,6 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
setState(() {
_passwordSuccess = tr(
'msg.userfront.profile.password.changed',
fallback: '비밀번호가 변경되었습니다.',
);
});
} catch (e) {
@@ -362,7 +356,6 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
setState(() {
_passwordError = tr(
'msg.userfront.profile.password.change_failed',
fallback: '비밀번호 변경 실패: {{error}}',
params: {'error': message},
);
});
@@ -440,7 +433,7 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
tr('msg.userfront.profile.name_required', fallback: '이름을 입력해주세요.'),
tr('msg.userfront.profile.name_required'),
),
),
);
@@ -452,7 +445,6 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
content: Text(
tr(
'msg.userfront.profile.department_required',
fallback: '소속을 입력해주세요.',
),
),
),
@@ -466,7 +458,6 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
content: Text(
tr(
'msg.userfront.profile.phone_required',
fallback: '휴대폰 번호를 입력해주세요.',
),
),
),
@@ -479,7 +470,6 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
content: Text(
tr(
'msg.userfront.profile.phone_verify_required',
fallback: '휴대폰 번호 인증이 필요합니다.',
),
),
),
@@ -525,7 +515,6 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
content: Text(
tr(
'msg.userfront.profile.update_success',
fallback: '정보가 수정되었습니다.',
),
),
),
@@ -538,7 +527,6 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
content: Text(
tr(
'msg.userfront.profile.update_failed',
fallback: '수정 실패: {{error}}',
params: {'error': e.toString()},
),
),
@@ -551,30 +539,40 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
}
Widget _buildSideMenu(BuildContext context) {
return ListView(
padding: const EdgeInsets.symmetric(vertical: 12),
return Column(
children: [
ListTile(
leading: const Icon(Icons.home_outlined),
title: Text(tr('ui.userfront.nav.dashboard', fallback: '대시보드')),
onTap: () => context.go('/'),
Expanded(
child: ListView(
padding: const EdgeInsets.symmetric(vertical: 12),
children: [
ListTile(
leading: const Icon(Icons.home_outlined),
title: Text(tr('ui.userfront.nav.dashboard')),
onTap: () => context.go('/'),
),
ListTile(
leading: const Icon(Icons.person_outline),
title: Text(tr('ui.userfront.nav.profile')),
selected: true,
onTap: () => context.go('/profile'),
),
ListTile(
leading: const Icon(Icons.qr_code_scanner),
title: Text(tr('ui.userfront.nav.qr_scan')),
onTap: () => context.go('/scan'),
),
const Divider(),
ListTile(
leading: const Icon(Icons.logout),
title: Text(tr('ui.userfront.nav.logout')),
onTap: _logout,
),
],
),
),
ListTile(
leading: const Icon(Icons.person_outline),
title: Text(tr('ui.userfront.nav.profile', fallback: '내 정보')),
selected: true,
onTap: () => context.go('/profile'),
),
ListTile(
leading: const Icon(Icons.qr_code_scanner),
title: Text(tr('ui.userfront.nav.qr_scan', fallback: 'QR 스캔')),
onTap: () => context.go('/scan'),
),
const Divider(),
ListTile(
leading: const Icon(Icons.logout),
title: Text(tr('ui.userfront.nav.logout', fallback: '로그아웃')),
onTap: _logout,
const Padding(
padding: EdgeInsets.only(bottom: 16),
child: LanguageSelector(compact: true),
),
],
);
@@ -626,13 +624,13 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
Widget _buildHeaderCard(UserProfile profile) {
final name = profile.name.isEmpty
? tr('msg.userfront.profile.name_missing', fallback: '이름 없음')
? tr('msg.userfront.profile.name_missing')
: profile.name;
final email = profile.email.isEmpty
? tr('msg.userfront.profile.email_missing', fallback: '이메일 없음')
? tr('msg.userfront.profile.email_missing')
: profile.email;
final department = profile.department.isEmpty
? tr('msg.userfront.profile.department_missing', fallback: '소속 정보 없음')
? tr('msg.userfront.profile.department_missing')
: profile.department;
return Container(
@@ -661,7 +659,6 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
Text(
tr(
'msg.userfront.profile.greeting',
fallback: '안녕하세요, {{name}}님',
params: {'name': name},
),
style: const TextStyle(
@@ -682,7 +679,7 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
children: [
_buildInfoChip(
Icons.badge_outlined,
tr('ui.userfront.profile.manage', fallback: '프로필 관리'),
tr('ui.userfront.profile.manage'),
),
_buildInfoChip(
Icons.apartment,
@@ -725,7 +722,7 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
title: Text(label),
subtitle: Text(displayValue),
trailing: Text(
tr('ui.common.read_only', fallback: '읽기 전용'),
tr('ui.common.read_only'),
style: TextStyle(color: Colors.grey[500], fontSize: 12),
),
);
@@ -749,7 +746,7 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
subtitle: Text(displayValue),
trailing: TextButton(
onPressed: isUpdating ? null : () => _startEditing(field, profile),
child: Text(tr('ui.common.edit', fallback: '수정')),
child: Text(tr('ui.common.edit')),
),
);
}
@@ -777,7 +774,7 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
const SizedBox(width: 12),
OutlinedButton(
onPressed: isUpdating ? null : () => _cancelEditing(profile),
child: Text(tr('ui.common.cancel', fallback: '취소')),
child: Text(tr('ui.common.cancel')),
),
],
),
@@ -792,11 +789,11 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
if (!isEditing) {
return ListTile(
contentPadding: EdgeInsets.zero,
title: Text(tr('ui.userfront.profile.phone.title', fallback: '전화번호')),
title: Text(tr('ui.userfront.profile.phone.title')),
subtitle: Text(displayValue),
trailing: TextButton(
onPressed: isUpdating ? null : () => _startEditing('phone', profile),
child: Text(tr('ui.common.edit', fallback: '수정')),
child: Text(tr('ui.common.edit')),
),
);
}
@@ -805,7 +802,7 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
tr('ui.userfront.profile.phone.title', fallback: '전화번호'),
tr('ui.userfront.profile.phone.title'),
style: const TextStyle(fontWeight: FontWeight.w600),
),
const SizedBox(height: 8),
@@ -835,17 +832,16 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
onPressed: _isVerifying ? null : _sendCode,
child: Text(
_isCodeSent
? tr('ui.common.resend', fallback: '재전송')
? tr('ui.common.resend')
: tr(
'ui.userfront.profile.phone.request_code',
fallback: '인증요청',
),
),
),
const SizedBox(width: 8),
OutlinedButton(
onPressed: isUpdating ? null : () => _cancelEditing(profile),
child: Text(tr('ui.common.cancel', fallback: '취소')),
child: Text(tr('ui.common.cancel')),
),
],
),
@@ -865,7 +861,6 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
border: const OutlineInputBorder(),
hintText: tr(
'ui.userfront.profile.phone.code_hint',
fallback: '인증번호 6자리',
),
),
),
@@ -873,7 +868,7 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
const SizedBox(width: 8),
ElevatedButton(
onPressed: _isVerifying ? null : () => _verifyCode(profile),
child: Text(tr('ui.common.confirm', fallback: '확인')),
child: Text(tr('ui.common.confirm')),
),
],
),
@@ -884,7 +879,6 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
child: Text(
tr(
'msg.userfront.profile.phone.verify_notice',
fallback: '휴대폰 번호를 변경하려면 SMS 인증이 필요합니다.',
),
style: const TextStyle(color: Colors.orange, fontSize: 12),
),
@@ -899,14 +893,13 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
tr('ui.userfront.profile.password.title', fallback: '비밀번호 변경'),
tr('ui.userfront.profile.password.title'),
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w700),
),
const SizedBox(height: 8),
Text(
tr(
'msg.userfront.profile.password.subtitle',
fallback: '현재 비밀번호 확인 후 새 비밀번호로 변경합니다.',
),
style: const TextStyle(color: Color(0xFF6B7280)),
),
@@ -917,7 +910,6 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
decoration: InputDecoration(
labelText: tr(
'ui.userfront.profile.password.current',
fallback: '현재 비밀번호',
),
border: const OutlineInputBorder(),
suffixIcon: IconButton(
@@ -939,7 +931,6 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
decoration: InputDecoration(
labelText: tr(
'ui.userfront.profile.password.new',
fallback: '새 비밀번호',
),
border: const OutlineInputBorder(),
suffixIcon: IconButton(
@@ -959,7 +950,6 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
decoration: InputDecoration(
labelText: tr(
'ui.userfront.profile.password.confirm',
fallback: '새 비밀번호 확인',
),
border: const OutlineInputBorder(),
suffixIcon: IconButton(
@@ -999,7 +989,6 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
: Text(
tr(
'ui.userfront.profile.password.change',
fallback: '비밀번호 변경',
),
),
),
@@ -1009,7 +998,6 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
child: Text(
tr(
'ui.userfront.profile.password.forgot',
fallback: '비밀번호를 잊으셨나요?',
),
),
),
@@ -1035,10 +1023,9 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
_buildHeaderCard(profile),
const SizedBox(height: 28),
_buildSectionTitle(
tr('ui.userfront.profile.section.basic', fallback: '기본 정보'),
tr('ui.userfront.profile.section.basic'),
tr(
'msg.userfront.profile.section.basic',
fallback: '계정 기본 정보를 관리합니다.',
),
),
const SizedBox(height: 12),
@@ -1049,7 +1036,6 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
field: 'name',
label: tr(
'ui.userfront.profile.field.name',
fallback: '이름',
),
value: profile.name,
profile: profile,
@@ -1060,7 +1046,6 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
_buildReadOnlyTile(
tr(
'ui.userfront.profile.field.email',
fallback: '이메일',
),
profile.email,
),
@@ -1073,11 +1058,9 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
_buildSectionTitle(
tr(
'ui.userfront.profile.section.organization',
fallback: '조직 정보',
),
tr(
'msg.userfront.profile.section.organization',
fallback: '소속 및 구분 정보입니다.',
),
),
const SizedBox(height: 12),
@@ -1088,7 +1071,6 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
field: 'department',
label: tr(
'ui.userfront.profile.field.department',
fallback: '소속',
),
value: profile.department,
profile: profile,
@@ -1099,7 +1081,6 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
_buildReadOnlyTile(
tr(
'ui.userfront.profile.field.affiliation',
fallback: '구분',
),
profile.affiliationType,
),
@@ -1108,7 +1089,6 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
_buildReadOnlyTile(
tr(
'ui.userfront.profile.field.tenant',
fallback: '소속 테넌트',
),
profile.tenant!.name,
),
@@ -1118,7 +1098,6 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
_buildReadOnlyTile(
tr(
'ui.userfront.profile.field.company_code',
fallback: '회사코드',
),
profile.companyCode,
),
@@ -1128,10 +1107,9 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
),
const SizedBox(height: 28),
_buildSectionTitle(
tr('ui.userfront.profile.section.security', fallback: '보안'),
tr('ui.userfront.profile.section.security'),
tr(
'msg.userfront.profile.section.security',
fallback: '비밀번호를 안전하게 관리합니다.',
),
),
const SizedBox(height: 12),
@@ -1160,7 +1138,7 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
if (profile == null) {
return Scaffold(
appBar: AppBar(
title: Text(tr('ui.userfront.nav.profile', fallback: '내 정보')),
title: Text(tr('ui.userfront.nav.profile')),
),
body: profileState.isLoading
? const Center(child: CircularProgressIndicator())
@@ -1171,14 +1149,13 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
Text(
tr(
'msg.userfront.profile.load_failed',
fallback: '정보를 불러올 수 없습니다.',
),
),
const SizedBox(height: 16),
ElevatedButton(
onPressed: () =>
ref.read(profileProvider.notifier).loadProfile(),
child: Text(tr('ui.common.retry', fallback: '재시도')),
child: Text(tr('ui.common.retry')),
),
],
),
@@ -1195,7 +1172,7 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
backgroundColor: _subtle,
appBar: AppBar(
title: Text(
tr('ui.userfront.app_title', fallback: 'Baron 로그인'),
tr('ui.userfront.app_title'),
style: const TextStyle(fontWeight: FontWeight.bold),
),
elevation: 0,
@@ -1204,17 +1181,17 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
actions: [
IconButton(
icon: const Icon(Icons.home_outlined),
tooltip: tr('ui.userfront.nav.dashboard', fallback: '대시보드'),
tooltip: tr('ui.userfront.nav.dashboard'),
onPressed: () => context.go('/'),
),
IconButton(
icon: const Icon(Icons.qr_code_scanner),
tooltip: tr('ui.userfront.nav.qr_scan', fallback: 'QR 스캔'),
tooltip: tr('ui.userfront.nav.qr_scan'),
onPressed: () => context.push('/scan'),
),
IconButton(
icon: const Icon(Icons.logout),
tooltip: tr('ui.userfront.nav.logout', fallback: '로그아웃'),
tooltip: tr('ui.userfront.nav.logout'),
onPressed: _logout,
),
],