feat(apps): 重构 UI 架构为 presentation 层并新增 l10n 国际化支持
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
import '../../l10n/app_localizations.dart';
|
||||
|
||||
class L10n {
|
||||
static Locale _locale = const Locale('zh');
|
||||
|
||||
static void setLocale(Locale locale) {
|
||||
_locale = locale;
|
||||
}
|
||||
|
||||
static AppLocalizations get current => lookupAppLocalizations(_locale);
|
||||
}
|
||||
|
||||
extension L10nContextX on BuildContext {
|
||||
AppLocalizations get l10n => AppLocalizations.of(this);
|
||||
}
|
||||
Reference in New Issue
Block a user