Locale Switcher plugin

The locale-switcher plugin provides a popover that allows to switch to other locale. The user interface then is updated instantly based on the selected locale.

Install

npm install '@react-pdf-viewer/locale-switcher';

Usage

  • Import the plugin:
import { localeSwitcherPlugin } from '@react-pdf-viewer/locale-switcher';
  • Create the plugin instance:
const localeSwitcherPluginInstance = localeSwitcherPlugin();

The plugin instance localeSwitcherPluginInstance provides the following property:

PropertyTypeDescriptionFrom
LocalePopoverReactElementThe default popover lists available locales2.0.0
  • Finally, register the locale-switcher plugin instance:
<Viewer
    fileUrl='...'
    plugins={[
        localeSwitcherPluginInstance,
    ]}
/>

Properties

The locale-switcher plugin provides other useful property as following:

import { LocaleIcon } from '@react-pdf-viewer/locale-switcher';
PropertyTypeDescriptionFrom
LocaleIconReactElementThe icon used in the LocalePopover component2.0.0

Examples