weblate_sdk 0.0.2
weblate_sdk: ^0.0.2 copied to clipboard
Unofficial WebLate SDK.
weblate_sdk #
Unofficial SDK to use Weblate service for a Web-based continuous localization;
Check Weblate documentation for more details.
Getting Started #
- Add package and localization support to your
pubspec.yaml
:
weblate_sdk: latest
flutter_localizations:
sdk: flutter
- Add initialization to your
main
function:
await WebLateSdk.initialize(
accessKey: 'your_weblate_key',
host: 'weblate_host',
projectName: 'name of project',
componentName: 'name of component',
defaultLanguage: 'en', //optional
);
Note: host should be without https:// (for example:
weblate.company.link
;
If
defaultLanguage
is set then if translation not found for current language then translation fordefaultLanguage
will be used instead;
- Add localization to
MaterialApp
:
supportedLocales: WebLateSdk.supportedLocales,
localizationsDelegates: [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
WebLateSdk.delegate,
]
- Use localized strings in your code:
context.localizedValueOf('key')
Note: Do not forgot to add internet permissions for you platforms