Skip to content

Commit

Permalink
fix: use correct determinants for weekend in pt_PT
Browse files Browse the repository at this point in the history
  • Loading branch information
limwa committed Feb 29, 2024
1 parent 200fc1c commit a4efefe
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 21 deletions.
13 changes: 6 additions & 7 deletions uni/lib/generated/intl/messages_all.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

import 'dart:async';

import 'package:flutter/foundation.dart';
import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';
import 'package:intl/src/intl_helpers.dart';
Expand All @@ -21,8 +20,8 @@ import 'messages_pt_PT.dart' as messages_pt_pt;

typedef Future<dynamic> LibraryLoader();
Map<String, LibraryLoader> _deferredLibraries = {
'en': () => new SynchronousFuture(null),
'pt_PT': () => new SynchronousFuture(null),
'en': () => new Future.value(null),
'pt_PT': () => new Future.value(null),
};

MessageLookupByLibrary? _findExact(String localeName) {
Expand All @@ -37,18 +36,18 @@ MessageLookupByLibrary? _findExact(String localeName) {
}

/// User programs should call this before using [localeName] for messages.
Future<bool> initializeMessages(String localeName) {
Future<bool> initializeMessages(String localeName) async {
var availableLocale = Intl.verifiedLocale(
localeName, (locale) => _deferredLibraries[locale] != null,
onFailure: (_) => null);
if (availableLocale == null) {
return new SynchronousFuture(false);
return new Future.value(false);
}
var lib = _deferredLibraries[availableLocale];
lib == null ? new SynchronousFuture(false) : lib();
await (lib == null ? new Future.value(false) : lib());
initializeInternalMessageLookup(() => new CompositeMessageLookup());
messageLookup.addLocale(availableLocale, _findGeneratedMessagesFor);
return new SynchronousFuture(true);
return new Future.value(true);
}

bool _messagesExistFor(String locale) {
Expand Down
13 changes: 7 additions & 6 deletions uni/lib/generated/intl/messages_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
// ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new
// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering
// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases
// ignore_for_file:unused_import, file_names, avoid_escaping_inner_quotes
// ignore_for_file:unnecessary_string_interpolations, unnecessary_string_escapes
// ignore_for_file:unused_import, file_names

import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';
Expand All @@ -20,12 +19,12 @@ typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'en';

static String m0(time) => "last refresh at ${time}";
static m0(time) => "last refresh at ${time}";

static String m1(time) =>
static m1(time) =>
"${Intl.plural(time, zero: 'Refreshed ${time} minutes ago', one: 'Refreshed ${time} minute ago', other: 'Refreshed ${time} minutes ago')}";

static String m2(title) => "${Intl.select(title, {
static m2(title) => "${Intl.select(title, {
'horario': 'Schedule',
'exames': 'Exams',
'area': 'Personal Area',
Expand All @@ -42,7 +41,7 @@ class MessageLookup extends MessageLookupByLibrary {
})}";

final messages = _notInlinedMessages(_notInlinedMessages);
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
static _notInlinedMessages(_) => <String, Function>{
"about": MessageLookupByLibrary.simpleMessage("About us"),
"academic_services":
MessageLookupByLibrary.simpleMessage("Academic services"),
Expand Down Expand Up @@ -179,6 +178,8 @@ class MessageLookup extends MessageLookupByLibrary {
MessageLookupByLibrary.simpleMessage("No classes to present"),
"no_classes_on":
MessageLookupByLibrary.simpleMessage("You don\'t have classes on"),
"no_classes_on_weekend":
MessageLookupByLibrary.simpleMessage("You don\'t have classes on"),
"no_college": MessageLookupByLibrary.simpleMessage("no college"),
"no_course_units": MessageLookupByLibrary.simpleMessage(
"No course units in the selected period"),
Expand Down
13 changes: 7 additions & 6 deletions uni/lib/generated/intl/messages_pt_PT.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
// ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new
// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering
// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases
// ignore_for_file:unused_import, file_names, avoid_escaping_inner_quotes
// ignore_for_file:unnecessary_string_interpolations, unnecessary_string_escapes
// ignore_for_file:unused_import, file_names

import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';
Expand All @@ -20,12 +19,12 @@ typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'pt_PT';

static String m0(time) => "última atualização às ${time}";
static m0(time) => "última atualização às ${time}";

static String m1(time) =>
static m1(time) =>
"${Intl.plural(time, zero: 'Atualizado há ${time} minutos', one: 'Atualizado há ${time} minuto', other: 'Atualizado há ${time} minutos')}";

static String m2(title) => "${Intl.select(title, {
static m2(title) => "${Intl.select(title, {
'horario': 'Horário',
'exames': 'Exames',
'area': 'Área Pessoal',
Expand All @@ -42,7 +41,7 @@ class MessageLookup extends MessageLookupByLibrary {
})}";

final messages = _notInlinedMessages(_notInlinedMessages);
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
static _notInlinedMessages(_) => <String, Function>{
"about": MessageLookupByLibrary.simpleMessage("Sobre nós"),
"academic_services":
MessageLookupByLibrary.simpleMessage("Serviços académicos"),
Expand Down Expand Up @@ -180,6 +179,8 @@ class MessageLookup extends MessageLookupByLibrary {
"Não existem aulas para apresentar"),
"no_classes_on":
MessageLookupByLibrary.simpleMessage("Não possui aulas à"),
"no_classes_on_weekend":
MessageLookupByLibrary.simpleMessage("Não possui aulas ao"),
"no_college": MessageLookupByLibrary.simpleMessage("sem faculdade"),
"no_course_units": MessageLookupByLibrary.simpleMessage(
"Sem cadeiras no período selecionado"),
Expand Down
12 changes: 11 additions & 1 deletion uni/lib/generated/l10n.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions uni/lib/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@
"@no_classes": {},
"no_classes_on": "You don't have classes on",
"@no_classes_on": {},
"no_classes_on_weekend": "You don't have classes on",
"@no_classes_on_weekend": {},
"no_college": "no college",
"@no_college": {},
"no_course_units": "No course units in the selected period",
Expand Down
2 changes: 2 additions & 0 deletions uni/lib/l10n/intl_pt_PT.arb
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@
"@no_classes": {},
"no_classes_on": "Não possui aulas à",
"@no_classes_on": {},
"no_classes_on_weekend": "Não possui aulas ao",
"@no_classes_on_weekend": {},
"no_college": "sem faculdade",
"@no_college": {},
"no_course_units": "Sem cadeiras no período selecionado",
Expand Down
6 changes: 5 additions & 1 deletion uni/lib/view/schedule/schedule.dart
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,14 @@ class SchedulePageViewState extends State<SchedulePageView>
final weekday =
Provider.of<LocaleNotifier>(context).getWeekdaysWithLocale()[day];

final noClassesText = day >= DateTime.saturday - 1
? S.of(context).no_classes_on_weekend
: S.of(context).no_classes_on;

return Center(
child: ImageLabel(
imagePath: 'assets/images/schedule.png',
label: '${S.of(context).no_classes_on} $weekday.',
label: '$noClassesText $weekday.',
labelTextStyle: const TextStyle(fontSize: 15),
),
);
Expand Down

0 comments on commit a4efefe

Please sign in to comment.