cyntler / react-doc-viewer

File viewer for React.
https://cyntler.github.io/react-doc-viewer
Apache License 2.0
373 stars 125 forks source link

Export locales so consumers can set language without duplicating code #272

Closed smorton-planview closed 3 months ago

smorton-planview commented 3 months ago

Consumers that want to set DocViewer language to a valid value from AvailableLanguages are currently forced to recreate an array of locales to compare against since AvailableLanguages is a union type and its values are compiled away and not available at run time.

This change aims to export the locales so that consumers can avoid duplicating the locales within their code. The goal would be to use navigator.language.split('-')[0] to produce a valid AvailableLanguages.

cyntler commented 3 months ago

@smorton-planview Has been merged! Will be delivered with the next release. Thanks!