Skip to content

Commit

Permalink
feat: i18n yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
popoway authored Oct 10, 2023
1 parent e0f524c commit 7dc5d82
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 39 deletions.
32 changes: 32 additions & 0 deletions assets/flutter_i18n/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,38 @@ tutoring:
writing-center: "Writing Center"
writing-center-message: "The Writing Center offers free writing support to all Queens College students, ranging from brainstorming, final revisions, to personal statements and cover letters.\nLocation: Kiely Hall 229\nEmail: [email protected]\nPhone: 718-997-5676"

transfer:
transfer-explorer: "CUNY Transfer Explorer"
transfer-explorer-message: "CUNY Transfer Explorer makes important information about college transfer public and easy to understand so that students know what to expect before they enroll in a new college.\n * CUNY login required"
transfer-explorer-by-course: "CUNY to CUNY by Course"
transfer-explorer-by-subject: "CUNY to CUNY by Subject"
transfer-explorer-by-transcript: "CUNY to CUNY by Transcript *"
qc-transfer-support: "QC Transfer Support"
qc-transfer-support-message: "ACE QC is a comprehensive support program designed to build on transfer students’ academic momentum and help students complete their bachelor’s degree on time."
qc-transfer-support-transfer-honors: "Transfer Honors"
qc-transfer-support-transfer-advising: "Transfer Advising"
qc-transfer-support-international-transfer: "International Transfer"

map:
hint: "Search buildings..."
building: "Building"

options:
my-academics: "My Academics"
apply-to-qc: "Apply to QC"
staff-email: "Staff Email"
student-email: "Student Email"
app-settings: "App Settings"
switch-role: "Switch Role"
send-feedback: "Send Feedback"
about-app: "About GoKnights"

aboutapp:
about: "About"
privacy-policy: "Privacy Policy"
open-source-licenses: "Open Source Licenses"
disclaimer: "Disclaimer"

button:
cancel: "Cancel"
learn-more: "Learn More"
7 changes: 4 additions & 3 deletions lib/aboutapp.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:package_info_plus/package_info_plus.dart';

Expand Down Expand Up @@ -105,12 +106,12 @@ class _AboutAppPageState extends State<AboutAppPage> {
fontSize: 16)),
),
CupertinoButton(
child: const Text('Privacy Policy'),
child: const Text(FlutterI18n.translate(context, "aboutapp.privacy-policy")),
onPressed: () => _launchURL(
'https://github.com/popoway/goknights/blob/main/PRIVACY.md'),
),
CupertinoButton(
child: const Text('Open Source Licenses'),
child: const Text(FlutterI18n.translate(context, "aboutapp.open-source-licenses")),
// Displays a LicensePage onClick
onPressed: () => showLicensePage(
context: context,
Expand All @@ -129,7 +130,7 @@ class _AboutAppPageState extends State<AboutAppPage> {
),
),
CupertinoButton(
child: const Text('Disclaimer'),
child: const Text(FlutterI18n.translate(context, "aboutapp.disclaimer")),
onPressed: () => _launchURL(
'https://github.com/popoway/goknights#disclaimer'),
),
Expand Down
3 changes: 2 additions & 1 deletion lib/dept/calendar.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:webview_flutter/webview_flutter.dart';
import 'package:share_plus/share_plus.dart';

Expand Down Expand Up @@ -51,7 +52,7 @@ class _MyCalendarPageState extends State<MyCalendarPage> {

return CupertinoPageScaffold(
navigationBar: CupertinoNavigationBar(
middle: const Text('Calendar'),
middle: const Text(FlutterI18n.translate(context, "home.calendar")),
trailing: CupertinoButton(
padding: EdgeInsets.zero,
child: Icon(CupertinoIcons.share),
Expand Down
3 changes: 2 additions & 1 deletion lib/dept/directory.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:webview_flutter/webview_flutter.dart';

Expand Down Expand Up @@ -83,7 +84,7 @@ class _MyDirectoryPageState extends State<MyDirectoryPage> {

return CupertinoPageScaffold(
navigationBar: const CupertinoNavigationBar(
middle: Text('Directory'),
middle: Text(FlutterI18n.translate(context, "home.directory")),
),
child: SafeArea(child: WebViewWidget(controller: controller)),
);
Expand Down
3 changes: 2 additions & 1 deletion lib/dept/shuttle_map.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:webview_flutter/webview_flutter.dart';

Expand Down Expand Up @@ -43,7 +44,7 @@ class _MyShuttleMapPageState extends State<MyShuttleMapPage> {

return CupertinoPageScaffold(
navigationBar: const CupertinoNavigationBar(
middle: Text('Shuttle Map'),
middle: Text(FlutterI18n.translate(context, "shuttle.shuttle-map")),
),
child: SafeArea(child: WebViewWidget(controller: controller)),
);
Expand Down
25 changes: 13 additions & 12 deletions lib/dept/transfer.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:url_launcher/url_launcher.dart';

class MyTransferPage extends StatefulWidget {
Expand All @@ -25,7 +26,7 @@ class _MyTransferPageState extends State<MyTransferPage> {
// A list of sliver widgets.
slivers: <Widget>[
const CupertinoSliverNavigationBar(
largeTitle: Text('Transfer'),
largeTitle: Text(FlutterI18n.translate(context, "home.transfer")),
),
// This widget fills the remaining space in the viewport.
// Drag the scrollable area to collapse the CupertinoSliverNavigationBar.
Expand All @@ -35,59 +36,59 @@ class _MyTransferPageState extends State<MyTransferPage> {
children: <Widget>[
CupertinoListSection.insetGrouped(
header:
Text('CUNY Transfer Explorer', style: optionTextStyle),
Text(FlutterI18n.translate(context, "transfer.transfer-explorer"), style: optionTextStyle),
footer: Text(
'CUNY Transfer Explorer makes important information about college transfer public and easy to understand so that students know what to expect before they enroll in a new college.\n * CUNY login required',
FlutterI18n.translate(context, "transfer.transfer-explorer-message"),
style: optionTextStyle),
children: <CupertinoListTile>[
CupertinoListTile.notched(
title: Text('CUNY to CUNY by Course',
title: Text(FlutterI18n.translate(context, "transfer.transfer-explorer-by-course"),
style: optionTextStyle),
trailing: const CupertinoListTileChevron(),
onTap: () => _launchURL(
'https://explorer.cuny.edu/course-transfer'),
),
CupertinoListTile.notched(
title: Text('CUNY to CUNY by Subject',
title: Text(FlutterI18n.translate(context, "transfer.transfer-explorer-by-subject"),
style: optionTextStyle),
trailing: const CupertinoListTileChevron(),
onTap: () => _launchURL(
'https://explorer.cuny.edu/transfer-rules'),
),
CupertinoListTile.notched(
title: Text('CUNY to CUNY by Transcript *',
title: Text(FlutterI18n.translate(context, "transfer.transfer-explorer-by-transcript"),
style: optionTextStyle),
trailing: const CupertinoListTileChevron(),
onTap: () =>
_launchURL('https://explorer.cuny.edu/logincuny'),
),
CupertinoListTile.notched(
title: Text('Learn More', style: optionTextStyle),
title: Text(FlutterI18n.translate(context, "button.learn-more"), style: optionTextStyle),
trailing: const CupertinoListTileChevron(),
onTap: () => _launchURL('https://explorer.cuny.edu/'),
),
],
),
CupertinoListSection.insetGrouped(
header: Text('QC Transfer Support', style: optionTextStyle),
header: Text(FlutterI18n.translate(context, "transfer.qc-transfer-support"), style: optionTextStyle),
footer: Text(
'ACE QC is a comprehensive support program designed to build on transfer students’ academic momentum and help students complete their bachelor’s degree on time.',
FlutterI18n.translate(context, "transfer.qc-transfer-support-message"),
style: optionTextStyle),
children: <CupertinoListTile>[
CupertinoListTile.notched(
title: Text('Transfer Honors', style: optionTextStyle),
title: Text(FlutterI18n.translate(context, "qc-transfer-support-transfer-honors"), style: optionTextStyle),
trailing: const CupertinoListTileChevron(),
onTap: () => _launchURL(
'https://www.qc.cuny.edu/academics/ohs/transfer-honors-program/'),
),
CupertinoListTile.notched(
title: Text('Transfer Advising', style: optionTextStyle),
title: Text(FlutterI18n.translate(context, "qc-transfer-support-transfer-advising"), style: optionTextStyle),
trailing: const CupertinoListTileChevron(),
onTap: () => _launchURL(
'https://www.qc.cuny.edu/aac/transfer-advising/'),
),
CupertinoListTile.notched(
title: Text('International Transfer',
title: Text(FlutterI18n.translate(context, "qc-transfer-support-international-transfer"),
style: optionTextStyle),
trailing: const CupertinoListTileChevron(),
onTap: () =>
Expand Down
5 changes: 3 additions & 2 deletions lib/map.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
Expand Down Expand Up @@ -316,7 +317,7 @@ class _MyMapPageState extends State<MyMapPage> {

return FloatingSearchBar(
controller: _floatingSearchBarController,
hint: 'Search buildings...',
hint: FlutterI18n.translate(context, "map.hint"),
autocorrect: false,
clearQueryOnClose: false,
borderRadius: const BorderRadius.all(Radius.circular(16)),
Expand Down Expand Up @@ -374,7 +375,7 @@ class _MyMapPageState extends State<MyMapPage> {
Brightness.light
? CupertinoColors.black
: CupertinoColors.white)),
subtitle: Text('Building',
subtitle: Text(FlutterI18n.translate(context, "map.building"),
style: TextStyle(
color: MediaQuery.of(context).platformBrightness ==
Brightness.light
Expand Down
Loading

0 comments on commit 7dc5d82

Please sign in to comment.