-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: Multi-language Support (#283)
* 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
Showing
48 changed files
with
1,831 additions
and
797 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
|
||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.