Skip to content

Instantly share code, notes, and snippets.

@rohan20
Created September 3, 2018 12:22
Show Gist options
  • Select an option

  • Save rohan20/620771ad80280b6e55a4fa5695c95ff5 to your computer and use it in GitHub Desktop.

Select an option

Save rohan20/620771ad80280b6e55a4fa5695c95ff5 to your computer and use it in GitHub Desktop.
flutter-localizations
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:your_app_package/services/localization/app_translations.dart';
class SpecificTranslationsDelegate extends LocalizationsDelegate<AppTranslations> {
final Locale overriddenLocale;
const SpecificTranslationsDelegate(this.overriddenLocale);
@override
bool isSupported(Locale locale) => overriddenLocale != null;
@override
Future<AppTranslations> load(Locale locale) => AppTranslations.load(overriddenLocale);
@override
bool shouldReload(LocalizationsDelegate<AppTranslations> old) => true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment