I18nManager class
Manages translations, locale selection, and RTL detection for the survey SDK.
Translations are loaded from SurveyTranslation entries and keyed by a composite of content type, content ID, and field key. The manager exposes convenience methods for translating specific survey content.
Constructors
- I18nManager({String locale = 'en'})
Properties
-
availableLocales
→ List<
String> -
Returns all locales that have at least one translation loaded.
no setter
-
enabledLanguages
→ List<
String> -
Returns the list of enabled language codes from settings.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- locale → String
-
The currently active locale code.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showLanguageSelector → bool
-
Whether the language selector should be shown to respondents.
no setter
Methods
-
hasTranslation(
String locale) → bool -
Returns
trueif at least one translation has been loaded forlocale. -
isRtl(
[String? locale]) → bool -
Returns
trueif the given locale (or the current locale) uses right-to-left text direction. -
loadTranslations(
List< SurveyTranslation> translations) → void - Loads a batch of translations into the manager.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setLanguageSettings(
SurveyLanguageSettings settings) → void - Configures the language settings from the survey.
-
setLocale(
String locale) → void - Sets the active locale.
-
toString(
) → String -
A string representation of this object.
inherited
-
translate(
TranslationContentType contentType, String contentId, String originalText, [String fieldKey = '']) → String - Translates content given its type, ID, and original text.
-
translateButtonText(
String buttonId, String originalText) → String - Translates a button label.
-
translateOptionLabel(
String optionId, String originalLabel) → String - Translates an option label.
-
translatePageDescription(
String pageId, String originalDescription) → String - Translates a page description.
-
translatePageTitle(
String pageId, String originalTitle) → String - Translates a page title.
-
translateQuestionDescription(
String questionId, String originalDescription) → String - Translates a question's description.
-
translateQuestionText(
String questionId, String originalText) → String - Translates a question's text.
-
translateSurveyDescription(
String surveyId, String originalDescription) → String - Translates the survey description.
-
translateSurveyTitle(
String surveyId, String originalTitle) → String - Translates the survey title.
-
translateThankYouMessage(
String surveyId, String originalMessage) → String - Translates the thank-you page message.
-
translateThankYouTitle(
String surveyId, String originalTitle) → String - Translates the thank-you page title.
-
translateValidationMessage(
String contentId, String originalMessage) → String - Translates a validation message.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited