Skip to content

Commit

Permalink
Feature: Multi-language Support (#283)
Browse files Browse the repository at this point in the history
* language support for german, russian, french, spanish added

* translations enabled for few remaining words

* more translations added according to upstream changes

* merged from original repo again

* get_storage_provider generalised, separated language files

* moved language functionalities to settings

* moved language functionalities to settings

* Delete pubspec.yaml

---------

Co-authored-by: Rijuth Menon <[email protected]>
  • Loading branch information
sapana-k and MarkisDev authored Jan 7, 2024
1 parent c916eec commit 90f5ea3
Show file tree
Hide file tree
Showing 48 changed files with 1,831 additions and 797 deletions.
31 changes: 31 additions & 0 deletions lib/app/data/providers/get_storage_provider.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import 'dart:ui';
import 'package:get/get.dart';
import 'package:get_storage/get_storage.dart';

class GetStorageProvider {
late final GetStorage _getStorage;

Future<GetStorageProvider> init() async {
await GetStorage.init();
_getStorage = GetStorage();
return this;
}

Future<Locale> readLocale() async {
final languageCode = _getStorage.read('languageCode');

return languageCode != null
? Locale(
languageCode,
_getStorage.read('countryCode') ?? '',
) : const Locale('en', 'EN');
}

Future<void> writeLocale(String lanCode, String countryCode) async {
await _getStorage.write('languageCode', lanCode);
await _getStorage.write('countryCode', countryCode);
}

}


18 changes: 9 additions & 9 deletions lib/app/modules/about/views/about_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class AboutView extends GetView<AboutController> {
return Scaffold(
appBar: AppBar(
title: Text(
'About',
'About'.tr,
style: Theme.of(context).textTheme.titleLarge!.copyWith(
color: themeController.isLightMode.value
? kLightPrimaryTextColor
Expand Down Expand Up @@ -50,16 +50,16 @@ class AboutView extends GetView<AboutController> {
),
),
const SizedBox(height: 10),
const Text(
'Ultimate Alarm Clock',
Text(
'Ultimate Alarm Clock'.tr,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 10),
const Text(
'Version: 0.5.0',
Text(
'Version: 0.5.0'.tr,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
Expand All @@ -68,8 +68,8 @@ class AboutView extends GetView<AboutController> {
const SizedBox(height: 10),
Container(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: const Text(
"This project was originally developed as part of Google Summer of code under the CCExtractor organization. It's free, the source code is available, and we encourage programmers to contribute.",
child: Text(
'This project was originally developed as part of Google Summer of code under the CCExtractor organization. It\'s free, the source code is available, and we encourage programmers to contribute'.tr,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 14,
Expand All @@ -95,7 +95,7 @@ class AboutView extends GetView<AboutController> {
if (!await aboutController
.launchUrl(Uri.parse(AboutController.githubUrl))) {
throw Exception(
'Could not launch ${AboutController.githubUrl}',
'Could not launch ${AboutController.githubUrl}'.tr,
);
}
},
Expand Down Expand Up @@ -129,7 +129,7 @@ class AboutView extends GetView<AboutController> {
Uri.parse(AboutController.ccExtractorUrl),
)) {
throw Exception(
'Could not launch ${AboutController.ccExtractorUrl}',
'Could not launch ${AboutController.ccExtractorUrl}'.tr,
);
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ class AddOrUpdateAlarmController extends GetxController {
final MapController mapController = MapController();
final selectedPoint = LatLng(0, 0).obs;
final RxList markersList = [].obs;
final daysRepeating = 'Never'.obs;
final weatherTypes = 'Off'.obs;
final daysRepeating = 'Never'.tr.obs;
final weatherTypes = 'Off'.tr.obs;
final selectedWeather = <WeatherTypes>[].obs;
final repeatDays =
<bool>[false, false, false, false, false, false, false].obs;
Expand Down Expand Up @@ -515,7 +515,7 @@ class AddOrUpdateAlarmController extends GetxController {
markersList.add(
Marker(
point: selectedPoint.value,
builder: (ctx) => const Icon(
child: const Icon(
Icons.location_on,
size: 35,
color: Colors.black,
Expand Down Expand Up @@ -583,7 +583,7 @@ class AddOrUpdateAlarmController extends GetxController {
markersList.add(
Marker(
point: point,
builder: (ctx) => const Icon(
child: const Icon(
Icons.location_on,
size: 35,
color: Colors.black,
Expand Down
Loading

0 comments on commit 90f5ea3

Please sign in to comment.