import 'package:flutter/material.dart';
import 'package:ongbut_ntmanh/localization/language/language_en.dart';


import 'language_vi.dart';
import 'languages.dart';

class AppLocalizationsDelegate extends LocalizationsDelegate<Languages> {
  const AppLocalizationsDelegate();

  @override
  bool isSupported(Locale locale) => ['en', 'vi'].contains(locale.languageCode);

  @override
  Future<Languages> load(Locale locale) => _load(locale);

  static Future<Languages> _load(Locale locale) async {
    switch (locale.languageCode) {
      case 'en':
        return LanguageEn();
      default:
        return LanguageVi();
    }
  }

  @override
  bool shouldReload(LocalizationsDelegate<Languages> old) => false;
}
