finos / perspective

A data visualization and analytics component, especially well-suited for large and/or streaming datasets.
https://perspective.finos.org/
Apache License 2.0
8.36k stars 1.17k forks source link

Localization Support #2565

Closed texodus closed 6 months ago

texodus commented 6 months ago

Adds localization support to integer, float, date and datetime Perspective types, and add parameterized text via CSS custom variables for all UI text in the <perspective-viewer> app.

Also includes CSS language files for de, es, fr, ja, pt and zh locales, as per Google Translate, which does a hilariously bad job at translating some of Perspective's jargon-y prose, ergo these language files are un-supported and included for demo purposes only. Contributions from native speakers welcome, but please fix the entire file in one PR.

The template for internationalized text is in intl.less, with individual languages in the intl/ directory. For example, by adding this to your documents's <head>:

<link rel="stylesheet" crossorigin="anonymous" href="@finos/perspective-viewer/dist/css/intl/ja.css" />

... and settings your Browser's locale to ja, you'll get a wildly inaccurate translation to Japanese:

Screenshot 2024-03-12 at 3 54 39 AM