stack_wallet/lib/services/locale_service.dart

30 lines
698 B
Dart
Raw Normal View History

2023-05-26 21:21:16 +00:00
/*
* This file is part of Stack Wallet.
*
* Copyright (c) 2023 Cypher Stack
* All Rights Reserved.
* The code is distributed under GPLv3 license, see LICENSE file for details.
* Generated by Cypher Stack on 2023-05-26
*
*/
import 'dart:io';
2023-04-17 21:36:16 +00:00
2022-08-26 08:11:35 +00:00
import 'package:devicelocale/devicelocale.dart';
import 'package:flutter/material.dart';
class LocaleService extends ChangeNotifier {
String _locale = "en_US"; // use default
String get locale => _locale;
Future<void> loadLocale({bool notify = true}) async {
2023-04-17 21:36:16 +00:00
_locale = Platform.isWindows
? "en_US"
2023-07-12 22:06:06 +00:00
: (await Devicelocale.currentAsLocale)?.toString() ?? "en_US";
2022-08-26 08:11:35 +00:00
if (notify) {
notifyListeners();
}
}
}