loadAsync<T> method

Future<ZooperLocalizer<T>> loadAsync<T>(
  1. String pathToAsset, {
  2. AssetLoader? loader,
  3. Locale? fallbackLocale,
  4. Locale localeDelegate()?,
  5. String csvDelimiter = ';',
})

Loads a file and registers it's translations

pathToAsset defines the relative path to the file. E.g.: 'assets/localizations/loc.csv' loader Optional parameter to define a custom loader. Default is automatically determined by the files extension fallbackLocale defines the locale which is returned when no matching locale was found. Default is en_US localeDelegate delegate to get a specific locale. Default is the systems locale

Implementation

Future<ZooperLocalizer<T>> loadAsync<T>(
  String pathToAsset, {
  AssetLoader? loader,
  Locale? fallbackLocale,
  Locale Function()? localeDelegate,
  String csvDelimiter = ';',
}) async {
  // If no explicit loader is provided, try to do it with the extension
  loader = loader ??
      _getLoaderByExtension(
        pathToAsset,
        fallbackLocale,
        localeDelegate,
        csvDelimiter,
      );

  return await loader.loadAsync<T>(pathToAsset);
}