QudsTranslation class
Control the language of the app
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- currLanguage → QudsLanguage?
-
The current language of the app
no setter
- deviceLocaleCode → String?
-
Get the current device locale code
no setter
-
languages
↔ Map<
String, QudsLanguage> -
The supported languages map in the app
getter/setter pair
- provider ↔ QudsTranslationProvider
-
An instance of QudsTranslationProvider to control the language and
notify if changed
getter/setter pair
Static Methods
-
addLanguage(
QudsLanguage lang) → void - Add a language to the languages list
-
getDeviceLocaleCode(
) → String - Get the device local code first part, As example 'en' =>'en' 'en_US' => 'en'
-
getLanguage(
String? code) → QudsLanguage? - Get the matching language
-
initialize(
List< String> supportedLanguageCodes, {Map<String, Map< ? additionalDictionaries, String? defaultLangCode, String? defaultFont, Map<String, String> >String, String> ? customFonts}) → void -
Initialize the translation service
supportedLanguageCodes
: the desired languages of the app as example['ar', 'en_US']
'additionalDictionaries': Supporting dictionaries for not translated words as example['ar': {'hi_message':'أهلًا بك'}]
-
setLanguage(
String code, {VoidCallback? onChanged}) → bool -
Set the current language of the app
code
: The language code, as example 'ar_PS'onChanged
: a callback fired when the set language changed -
setSavedLang(
{String? defaultLang}) → void - Apply the saved language
-
showLanguagesSelectionBorderSheet(
BuildContext context, {bool autoSave = true, VoidCallback? onChanged, bool withFlagImage = true, bool withCountryName = true}) → void - Show border modal sheet with translation options
-
translate(
String key, {String? langCode}) → String -
Get the
key
corresponding translation, by default, it translate to the current set language.langCode
if a specific language code desired