Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -256,5 +256,23 @@
"schedule": "Schedule",
"@schedule": {
"description": "Label for the schedule button in the bottom navigation bar"
},
"hourFormatted": "{count,plural, =1{{count} hour} other{{count} hours}}",
"@hourFormatted": {
"description": "A formatted string for hours, handling pluralization.",
"placeholders": {
"count": {
"type": "int"
}
}
},
"minuteFormatted": "{count,plural, =1{{count} minute} other{{count} minutes}}",
"@minuteFormatted": {
"description": "A formatted string for minutes, handling pluralization.",
"placeholders": {
"count": {
"type": "int"
}
}
}
}
6 changes: 4 additions & 2 deletions lib/l10n/app_ko.arb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"preparationOrderTitle": "앞에서 고른 준비 과정의 순서를\n알려주세요",
"preparationNameTitle": "주로 하는 준비 과정을\n선택해주세요 ",
"multipleSelection": "(복수 선택)",
"preparationTimeTitle": "과정별로 소요되는 시간을\n알려주세요",
"preparationTimeTitle": "준비 시간",
"addAppointment": "약속 추가하기",
"next": "다음",
"appointmentName": "약속 이름",
Expand Down Expand Up @@ -60,5 +60,7 @@
"home": "홈",
"myPage": "마이",
"plus": "플러스",
"schedule": "일정"
"schedule": "일정",
"hourFormatted": "{count}시간",
"minuteFormatted": "{count}분"
}
44 changes: 30 additions & 14 deletions lib/l10n/app_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,17 @@ import 'app_localizations_ko.dart';
/// be consistent with the languages listed in the AppLocalizations.supportedLocales
/// property.
abstract class AppLocalizations {
AppLocalizations(String locale) : localeName = intl.Intl.canonicalizedLocale(locale.toString());
AppLocalizations(String locale)
: localeName = intl.Intl.canonicalizedLocale(locale.toString());

final String localeName;

static AppLocalizations? of(BuildContext context) {
return Localizations.of<AppLocalizations>(context, AppLocalizations);
}

static const LocalizationsDelegate<AppLocalizations> delegate = _AppLocalizationsDelegate();
static const LocalizationsDelegate<AppLocalizations> delegate =
_AppLocalizationsDelegate();

/// A list of this localizations delegate along with the default localizations
/// delegates.
Expand All @@ -82,7 +84,8 @@ abstract class AppLocalizations {
/// Additional delegates can be added by appending to this list in
/// MaterialApp. This list does not have to be used at all if a custom list
/// of delegates is preferred or required.
static const List<LocalizationsDelegate<dynamic>> localizationsDelegates = <LocalizationsDelegate<dynamic>>[
static const List<LocalizationsDelegate<dynamic>> localizationsDelegates =
<LocalizationsDelegate<dynamic>>[
delegate,
GlobalMaterialLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
Expand Down Expand Up @@ -466,9 +469,22 @@ abstract class AppLocalizations {
/// In en, this message translates to:
/// **'Schedule'**
String get schedule;

/// A formatted string for hours, handling pluralization.
///
/// In en, this message translates to:
/// **'{count,plural, =1{{count} hour} other{{count} hours}}'**
String hourFormatted(int count);

/// A formatted string for minutes, handling pluralization.
///
/// In en, this message translates to:
/// **'{count,plural, =1{{count} minute} other{{count} minutes}}'**
String minuteFormatted(int count);
}

class _AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations> {
class _AppLocalizationsDelegate
extends LocalizationsDelegate<AppLocalizations> {
const _AppLocalizationsDelegate();

@override
Expand All @@ -477,25 +493,25 @@ class _AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations>
}

@override
bool isSupported(Locale locale) => <String>['en', 'ko'].contains(locale.languageCode);
bool isSupported(Locale locale) =>
<String>['en', 'ko'].contains(locale.languageCode);

@override
bool shouldReload(_AppLocalizationsDelegate old) => false;
}

AppLocalizations lookupAppLocalizations(Locale locale) {


// Lookup logic when only language code is specified.
switch (locale.languageCode) {
case 'en': return AppLocalizationsEn();
case 'ko': return AppLocalizationsKo();
case 'en':
return AppLocalizationsEn();
case 'ko':
return AppLocalizationsKo();
}

throw FlutterError(
'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely '
'an issue with the localizations generation tool. Please file an issue '
'on GitHub with a reproducible sample app and the gen-l10n configuration '
'that was used.'
);
'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely '
'an issue with the localizations generation tool. Please file an issue '
'on GitHub with a reproducible sample app and the gen-l10n configuration '
'that was used.');
}
52 changes: 42 additions & 10 deletions lib/l10n/app_localizations_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ class AppLocalizationsEn extends AppLocalizations {
String get setSpareTimeTitle => 'Set your spare time';

@override
String get setSpareTimeDescription => 'You can arrive early by the spare time you set.';
String get setSpareTimeDescription =>
'You can arrive early by the spare time you set.';

@override
String get setSpareTimeWarning => 'You must set a spare time in case of unexpected situations.';
String get setSpareTimeWarning =>
'You must set a spare time in case of unexpected situations.';

@override
String get todaysAppointments => 'Today\'s Appointments';
Expand All @@ -51,7 +53,8 @@ class AppLocalizationsEn extends AppLocalizations {
String get pleaseAllowNotifications => 'Please allow notifications';

@override
String get notificationPermissionDescription => 'OnTime needs notifications to help you get ready';
String get notificationPermissionDescription =>
'OnTime needs notifications to help you get ready';

@override
String get late => ' late';
Expand All @@ -66,7 +69,8 @@ class AppLocalizationsEn extends AppLocalizations {
String get areYouRunningLate => 'Are you running late?';

@override
String get runningLateDescription => 'If you\'re not ready yet, you can stay and continue preparing.\nBut you might be late!';
String get runningLateDescription =>
'If you\'re not ready yet, you can stay and continue preparing.\nBut you might be late!';

@override
String get continuePreparing => 'Continue Preparing';
Expand All @@ -81,22 +85,26 @@ class AppLocalizationsEn extends AppLocalizations {
String get welcome => 'Welcome!';

@override
String get onboardingStartSubtitle => 'To get ready with OnTime,\nplease tell us about your usual preparation process.';
String get onboardingStartSubtitle =>
'To get ready with OnTime,\nplease tell us about your usual preparation process.';

@override
String get start => 'Start';

@override
String get preparationOrderTitle => 'Please tell us the order of the preparation process you selected.';
String get preparationOrderTitle =>
'Please tell us the order of the preparation process you selected.';

@override
String get preparationNameTitle => 'Please select your usual preparation process.';
String get preparationNameTitle =>
'Please select your usual preparation process.';

@override
String get multipleSelection => '(Multiple selection)';

@override
String get preparationTimeTitle => 'Please tell us the time required for each step.';
String get preparationTimeTitle =>
'Please tell us the time required for each step.';

@override
String get addAppointment => 'Add appointment';
Expand Down Expand Up @@ -160,7 +168,8 @@ class AppLocalizationsEn extends AppLocalizations {
String get ok => 'OK';

@override
String get youWillBeLate => 'If you don\'t start preparing now, you\'ll be late!';
String get youWillBeLate =>
'If you don\'t start preparing now, you\'ll be late!';

@override
String get startPreparing => 'Start Preparing';
Expand All @@ -169,7 +178,8 @@ class AppLocalizationsEn extends AppLocalizations {
String get confirmLeave => 'Are you sure you want to leave?';

@override
String get confirmLeaveDescription => 'If you leave this screen,\nwe won\'t be able to prepare for the appointment together.';
String get confirmLeaveDescription =>
'If you leave this screen,\nwe won\'t be able to prepare for the appointment together.';

@override
String get leave => 'I\'m leaving';
Expand Down Expand Up @@ -197,4 +207,26 @@ class AppLocalizationsEn extends AppLocalizations {

@override
String get schedule => 'Schedule';

@override
String hourFormatted(int count) {
String _temp0 = intl.Intl.pluralLogic(
count,
locale: localeName,
other: '$count hours',
one: '$count hour',
);
return '$_temp0';
}

@override
String minuteFormatted(int count) {
String _temp0 = intl.Intl.pluralLogic(
count,
locale: localeName,
other: '$count minutes',
one: '$count minute',
);
return '$_temp0';
}
}
21 changes: 17 additions & 4 deletions lib/l10n/app_localizations_ko.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ class AppLocalizationsKo extends AppLocalizations {
String get pleaseAllowNotifications => '알림을 허용해주세요';

@override
String get notificationPermissionDescription => '알림을 허용해야 온타임이 준비를 \n도와드릴 수 있어요';
String get notificationPermissionDescription =>
'알림을 허용해야 온타임이 준비를 \n도와드릴 수 있어요';

@override
String get late => ' 지각했어요';
Expand All @@ -66,7 +67,8 @@ class AppLocalizationsKo extends AppLocalizations {
String get areYouRunningLate => '준비가 늦어졌나요?';

@override
String get runningLateDescription => '아직 준비가 늦었다면 남아서 계속 준비하세요.\n하지만 늦을 지도 몰라요!';
String get runningLateDescription =>
'아직 준비가 늦었다면 남아서 계속 준비하세요.\n하지만 늦을 지도 몰라요!';

@override
String get continuePreparing => '계속 준비';
Expand All @@ -81,7 +83,8 @@ class AppLocalizationsKo extends AppLocalizations {
String get welcome => '반가워요!';

@override
String get onboardingStartSubtitle => 'Ontime과 함께 준비하기 위해서\n평소 본인의 준비 과정을 알려주세요';
String get onboardingStartSubtitle =>
'Ontime과 함께 준비하기 위해서\n평소 본인의 준비 과정을 알려주세요';

@override
String get start => '시작하기';
Expand All @@ -96,7 +99,7 @@ class AppLocalizationsKo extends AppLocalizations {
String get multipleSelection => '(복수 선택)';

@override
String get preparationTimeTitle => '과정별로 소요되는 시간을\n알려주세요';
String get preparationTimeTitle => '준비 시간';

@override
String get addAppointment => '약속 추가하기';
Expand Down Expand Up @@ -197,4 +200,14 @@ class AppLocalizationsKo extends AppLocalizations {

@override
String get schedule => '일정';

@override
String hourFormatted(int count) {
return '$count시간';
}

@override
String minuteFormatted(int count) {
return '$count분';
}
}
22 changes: 11 additions & 11 deletions lib/presentation/calendar/component/schedule_detail.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import 'package:flutter_svg/svg.dart';
import 'package:flutter_swipe_action_cell/core/cell.dart';
import 'package:on_time_front/domain/entities/schedule_entity.dart';
import 'package:on_time_front/l10n/app_localizations.dart';
import 'package:on_time_front/presentation/shared/utils/duration_format.dart';
import 'package:intl/intl.dart';

// Helper widget for swipe actions
class _SwipeActionContent extends StatelessWidget {
Expand Down Expand Up @@ -114,8 +116,7 @@ class _ScheduleDetailState extends State<ScheduleDetail> {
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: _ScheduleTimeColumn(
hour: widget.schedule.scheduleTime.hour,
period: "PM",
scheduleTime: widget.schedule.scheduleTime,
),
),
const _VerticalDivider(),
Expand All @@ -134,26 +135,26 @@ class _ScheduleDetailState extends State<ScheduleDetail> {
}

class _ScheduleTimeColumn extends StatelessWidget {
const _ScheduleTimeColumn({required this.hour, required this.period});
const _ScheduleTimeColumn({required this.scheduleTime});

final int hour;
final String period;
final DateTime scheduleTime;

@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final locale = AppLocalizations.of(context)!.localeName;
return Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
hour.toString(),
DateFormat.j(locale).format(scheduleTime),
style: theme.textTheme.titleSmall,
textAlign: TextAlign.center,
),
const SizedBox(height: 4),
Text(
period,
DateFormat('a', locale).format(scheduleTime),
style: theme.textTheme.bodySmall?.copyWith(
color: theme.colorScheme.outline,
),
Expand Down Expand Up @@ -205,14 +206,13 @@ class _ScheduleDetailsColumn extends StatelessWidget {
children: [
ScheduleInfoTile(
label: AppLocalizations.of(context)!.travelTime,
value:
'${schedule.scheduleTime.hour}${AppLocalizations.of(context)!.hours} ${schedule.scheduleTime.minute}${AppLocalizations.of(context)!.minutes}',
value: formatDuration(context, schedule.moveTime),
),
//TODO: add preparation time
ScheduleInfoTile(
label: AppLocalizations.of(context)!.spareTime,
value:
'${schedule.scheduleSpareTime?.inMinutes}${AppLocalizations.of(context)!.minutes}',
value: formatDuration(
context, schedule.scheduleSpareTime ?? Duration.zero),
),
],
),
Expand Down
Loading
Loading