WebLateSdk class

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

canInitialize() Future<bool>
Check is library can be initialized; On first app run app requires internet connection to cache translations strings;
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

defaultLanguage String
Get default language. By default means completed;
no setter
delegate LocalizationsDelegate
Localization delegate. Add this to localizationsDelegates of your MaterialApp;
no setter
fallbackTranslations → LanguageKeys?
Get local fallback translations;
no setter
isFullyInitialized bool
Is initialization completed or not;
no setter
isSDKInitialized bool
Is initialization completed or not;
no setter
isTranslationsFetchSuccess bool
Is translations fetched successfully or not;
no setter
setTestDefaultLanguage String
no getter
setTestIsInitialized bool
no getter
supportedLocales List<Locale>
List of supported locales based on WebLate languages list;
no setter
translations → TranslationsMap
Map of all available translations;
no setter

Static Methods

initialize({required String token, required String host, required String projectName, required String componentName, required String defaultLanguage, bool? disableCache, Duration? cacheLive, String? fallbackJson}) Future<bool>
Initialize library. Call this function in main function of your app; token - you can find it in your WebLate project in Api Access section; host - host of your WebLate. Host should be without https://. for example: weblate.company.link; projectName - name of your WebLate project; componentName - name of your WebLate project component to use; For example you can use different components for different platforms so specify in componentName what component app should use depending on platform; defaultLanguage (Optional) - default app language. If translation not found for current language then translation for defaultLanguage will be used instead; If defaultLanguage is not set empty string will be returned; disableCache - disable or enable caching. By default cache disabled on debug and enabled on release; cacheLive - cache live time. By default 2 hours; fallbackJson - set local JSON translations file for case when you do not have internet connection and cached translations;
setFallbackTranslations(String fallbackJson) Future<void>