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'); +}