Skip to content

Commit

Permalink
Use SynchronusFuture in translations (ueman#146)
Browse files Browse the repository at this point in the history
  • Loading branch information
ueman committed Dec 27, 2021
1 parent 56144f1 commit 6bf66ce
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions feedback/lib/src/l18n/translation.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:feedback/src/debug.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import '../better_feedback.dart';
Expand Down Expand Up @@ -149,14 +150,15 @@ class GlobalFeedbackLocalizationsDelegate
}

@override
Future<FeedbackLocalizations> load(Locale locale) async {
Future<FeedbackLocalizations> load(Locale locale) {
final languageLocale = Locale(locale.languageCode);
// We only support language codes for now
if (_supportedLocales.containsKey(languageLocale)) {
return _supportedLocales[languageLocale]!;
return SynchronousFuture<FeedbackLocalizations>(
_supportedLocales[languageLocale]!);
}
// The default is english
return const EnFeedbackLocalizations();
return SynchronousFuture(const EnFeedbackLocalizations());
}

@override
Expand Down

0 comments on commit 6bf66ce

Please sign in to comment.