diff --git a/assets/flutter_i18n/en.yaml b/assets/flutter_i18n/en.yaml index 96b0883..ad237d8 100644 --- a/assets/flutter_i18n/en.yaml +++ b/assets/flutter_i18n/en.yaml @@ -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: qc.writing.center@qc.cuny.edu\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" \ No newline at end of file diff --git a/lib/aboutapp.dart b/lib/aboutapp.dart index 196238d..9ee9a03 100644 --- a/lib/aboutapp.dart +++ b/lib/aboutapp.dart @@ -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'; @@ -105,12 +106,12 @@ class _AboutAppPageState extends State { 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, @@ -129,7 +130,7 @@ class _AboutAppPageState extends State { ), ), CupertinoButton( - child: const Text('Disclaimer'), + child: const Text(FlutterI18n.translate(context, "aboutapp.disclaimer")), onPressed: () => _launchURL( 'https://github.com/popoway/goknights#disclaimer'), ), diff --git a/lib/dept/calendar.dart b/lib/dept/calendar.dart index 6d48997..643799e 100644 --- a/lib/dept/calendar.dart +++ b/lib/dept/calendar.dart @@ -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'; @@ -51,7 +52,7 @@ class _MyCalendarPageState extends State { 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), diff --git a/lib/dept/directory.dart b/lib/dept/directory.dart index e2e3879..3fde491 100644 --- a/lib/dept/directory.dart +++ b/lib/dept/directory.dart @@ -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'; @@ -83,7 +84,7 @@ class _MyDirectoryPageState extends State { return CupertinoPageScaffold( navigationBar: const CupertinoNavigationBar( - middle: Text('Directory'), + middle: Text(FlutterI18n.translate(context, "home.directory")), ), child: SafeArea(child: WebViewWidget(controller: controller)), ); diff --git a/lib/dept/shuttle_map.dart b/lib/dept/shuttle_map.dart index ee9f0c3..22c5f71 100644 --- a/lib/dept/shuttle_map.dart +++ b/lib/dept/shuttle_map.dart @@ -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'; @@ -43,7 +44,7 @@ class _MyShuttleMapPageState extends State { return CupertinoPageScaffold( navigationBar: const CupertinoNavigationBar( - middle: Text('Shuttle Map'), + middle: Text(FlutterI18n.translate(context, "shuttle.shuttle-map")), ), child: SafeArea(child: WebViewWidget(controller: controller)), ); diff --git a/lib/dept/transfer.dart b/lib/dept/transfer.dart index 632d467..b5f1e0c 100644 --- a/lib/dept/transfer.dart +++ b/lib/dept/transfer.dart @@ -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 { @@ -25,7 +26,7 @@ class _MyTransferPageState extends State { // A list of sliver widgets. slivers: [ 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. @@ -35,59 +36,59 @@ class _MyTransferPageState extends State { children: [ 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.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.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: () => diff --git a/lib/map.dart b/lib/map.dart index 0217c25..01c5d1d 100644 --- a/lib/map.dart +++ b/lib/map.dart @@ -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'; @@ -316,7 +317,7 @@ class _MyMapPageState extends State { return FloatingSearchBar( controller: _floatingSearchBarController, - hint: 'Search buildings...', + hint: FlutterI18n.translate(context, "map.hint"), autocorrect: false, clearQueryOnClose: false, borderRadius: const BorderRadius.all(Radius.circular(16)), @@ -374,7 +375,7 @@ class _MyMapPageState extends State { 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 diff --git a/lib/options.dart b/lib/options.dart index b3933f4..20a9c49 100644 --- a/lib/options.dart +++ b/lib/options.dart @@ -1,5 +1,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_i18n/flutter_i18n.dart'; import 'package:goknights/main.dart'; import 'package:goknights/onboarding.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -29,10 +30,10 @@ class _MyOptionsPageState extends State { CupertinoListSection myAcademicListSection = CupertinoListSection.insetGrouped( - header: Text('My Academics', style: optionTextStyle), + header: Text(FlutterI18n.translate(context, "options.my-academics"), style: optionTextStyle), children: [ CupertinoListTile.notched( - title: Text('Apply to QC', style: optionTextStyle), + title: Text(FlutterI18n.translate(context, "options.apply-to-qc"), style: optionTextStyle), leading: const Icon( CupertinoIcons.square_arrow_right, ), @@ -66,10 +67,10 @@ class _MyOptionsPageState extends State { { setState(() { myAcademicListSection = CupertinoListSection.insetGrouped( - header: Text('My Academics', style: optionTextStyle), + header: Text(FlutterI18n.translate(context, "options.my-academics"), style: optionTextStyle), children: [ CupertinoListTile.notched( - title: Text('Apply to QC', style: optionTextStyle), + title: Text(FlutterI18n.translate(context, "options.apply-to-qc"), style: optionTextStyle), leading: const Icon( CupertinoIcons.square_arrow_right, ), @@ -102,7 +103,7 @@ class _MyOptionsPageState extends State { { setState(() { myAcademicListSection = CupertinoListSection.insetGrouped( - header: Text('My Academics', style: optionTextStyle), + header: Text(FlutterI18n.translate(context, "options.my-academics"), style: optionTextStyle), children: [ CupertinoListTile.notched( title: Text('CUNYFirst', style: optionTextStyle), @@ -122,7 +123,7 @@ class _MyOptionsPageState extends State { onTap: () => _launchURL('https://bbhosted.cuny.edu'), ), CupertinoListTile.notched( - title: Text('Staff Email', style: optionTextStyle), + title: Text(FlutterI18n.translate(context, "options.staff-email"), style: optionTextStyle), leading: const Icon( CupertinoIcons.mail, ), @@ -150,7 +151,7 @@ class _MyOptionsPageState extends State { { setState(() { myAcademicListSection = CupertinoListSection.insetGrouped( - header: Text('My Academics', style: optionTextStyle), + header: Text(FlutterI18n.translate(context, "options.my-academics"), style: optionTextStyle), children: [ CupertinoListTile.notched( title: Text('CUNYFirst', style: optionTextStyle), @@ -170,7 +171,7 @@ class _MyOptionsPageState extends State { onTap: () => _launchURL('https://bbhosted.cuny.edu'), ), CupertinoListTile.notched( - title: Text('Student Email', style: optionTextStyle), + title: Text(FlutterI18n.translate(context, "options.student-email"), style: optionTextStyle), leading: const Icon( CupertinoIcons.mail, ), @@ -250,7 +251,7 @@ class _MyOptionsPageState extends State { // A list of sliver widgets. slivers: [ const CupertinoSliverNavigationBar( - largeTitle: Text('Me'), + largeTitle: Text(FlutterI18n.translate(context, "home.me")), ), // This widget fills the remaining space in the viewport. // Drag the scrollable area to collapse the CupertinoSliverNavigationBar. @@ -273,10 +274,10 @@ class _MyOptionsPageState extends State { ], ), CupertinoListSection.insetGrouped( - header: Text('App Settings', style: optionTextStyle), + header: Text(FlutterI18n.translate(context, "options.app-settings"), style: optionTextStyle), children: [ CupertinoListTile.notched( - title: Text('Switch Role', style: optionTextStyle), + title: Text(FlutterI18n.translate(context, "options.switch-role"), style: optionTextStyle), leading: const Icon( CupertinoIcons.person_2, ), @@ -299,10 +300,10 @@ class _MyOptionsPageState extends State { // if 'current', then show 'Current Student', if 'prospective', then show 'Prospective Student', if 'faculty', then show 'Faculty / Staff' return Text( snapshot.data == 'current' - ? 'Current Student' + ? FlutterI18n.translate(context, "role.current") : snapshot.data == 'prospective' - ? 'Prospective Student' - : 'Faculty / Staff', + ? FlutterI18n.translate(context, "role.prospective") + : FlutterI18n.translate(context, "role.faculty"), ); } } @@ -311,12 +312,12 @@ class _MyOptionsPageState extends State { // need to pop the current page (with nav) to go back to onboarding Navigator.of(context, rootNavigator: true).push( CupertinoPageRoute( - builder: (context) => const OnboardingPage( - title: 'Welcome to GoKnights'))), + builder: (context) => OnboardingPage( + title: FlutterI18n.translate(context, "onboarding.title")))), }, ), CupertinoListTile.notched( - title: Text('Send Feedback', style: optionTextStyle), + title: Text(FlutterI18n.translate(context, "options.send-feedback"), style: optionTextStyle), leading: const Icon( CupertinoIcons.pencil_outline, ), @@ -326,7 +327,7 @@ class _MyOptionsPageState extends State { 'mailto:goknights-feedback@popoway.com?subject=GoKnights%20Feedback%20v${_packageInfo.version}%20(${_packageInfo.buildNumber})&body=Please%20do%20not%20remove%20the%20app%20version%20and%20build%20number%20below%20when%20sending%20feedback.%0A%0A%0A%0A%0A%0A%0A%0A%0A%0AApp%20Version%3A%20${_packageInfo.version}%0ABuild%20Number%3A%20${_packageInfo.buildNumber}%0A'), ), CupertinoListTile.notched( - title: Text('About GoKnights', style: optionTextStyle), + title: Text(FlutterI18n.translate(context, "options.about-app"), style: optionTextStyle), leading: const Icon( CupertinoIcons.info, ), @@ -335,7 +336,7 @@ class _MyOptionsPageState extends State { Navigator.of(context).push( CupertinoPageRoute( builder: (BuildContext context) => - const AboutAppPage(title: 'About'), + const AboutAppPage(title: FlutterI18n.translate(context, "aboutapp.about")), ), ); },