Nutrient Web SDK

ReferenceNutrientViewerI18npreloadLocalizationData

Function preloadLocalizationData

Nutrient Web SDK comes with a number of predefined locales which are loaded automatically on demand when using the NutrientViewer.Instance#setLocale API or when setting a locale in the main Configuration.

The locale information are then exposed to NutrientViewer.I18n.messages.

You can use this method to preload these information instead of loading them on demand. This would allow you to modify some translations before loading Nutrient Web SDK for example.

Function
Type Signature
preloadLocalizationData(
    locale: Locale | string & {},
    options?: { baseUrl?: string },
): Promise<void>
  • Type Declaration

    Parameters

    localeLocale | string & {}

    The locale to load the localization data for.

    options{ baseUrl?: string } = {}

    The options for the preloadLocalizationData function.

    Returns

    Promise<void>

    Returns a promise that resolves when the locale data have been loaded.

    Errors

    NutrientViewer.Error Will throw when the locale is not supported, when no translations are bundled for it, or when the chunk carrying them could not be fetched. Only the fetch failure carries the underlying error as error.cause.