From cac51e0a5a6715251a3629561ea176f4bc1b2c40 Mon Sep 17 00:00:00 2001 From: Jacob Moura Date: Tue, 27 Aug 2024 10:49:04 -0300 Subject: [PATCH] add avaliable languages --- lib/src/localization/language_manager.dart | 12 ++++++++++++ .../languages/portuguese_brazillian_language.dart | 5 +++++ 2 files changed, 17 insertions(+) create mode 100644 lib/src/localization/languages/portuguese_brazillian_language.dart diff --git a/lib/src/localization/language_manager.dart b/lib/src/localization/language_manager.dart index 9b4217a..2c463a7 100644 --- a/lib/src/localization/language_manager.dart +++ b/lib/src/localization/language_manager.dart @@ -1,4 +1,12 @@ import '../../lucid_validation.dart'; +import 'languages/portuguese_brazillian_language.dart'; + +final _avaliableLanguages = { + 'pt_BR': PortugueseBrasillianLanguage(), + 'pt': PortugueseBrasillianLanguage(), + 'en': EnglishLanguage(), + 'en_US': EnglishLanguage(), +}; abstract class LanguageManager { final _globalTranslations = >{}; @@ -22,6 +30,10 @@ abstract class LanguageManager { } return message; } + + Language getLanguage(String culture) { + return _avaliableLanguages[culture] ?? LucidValidation.global.language; + } } class DefaultLanguageManager extends LanguageManager {} diff --git a/lib/src/localization/languages/portuguese_brazillian_language.dart b/lib/src/localization/languages/portuguese_brazillian_language.dart new file mode 100644 index 0000000..bcfe954 --- /dev/null +++ b/lib/src/localization/languages/portuguese_brazillian_language.dart @@ -0,0 +1,5 @@ +import '../language.dart'; + +class PortugueseBrasillianLanguage extends Language { + PortugueseBrasillianLanguage() : super('pt_BR'); +}