layerchart icon indicating copy to clipboard operation
layerchart copied to clipboard

Intl support

Open techniq opened this issue 6 months ago • 0 comments

Under the hood, LayerChart uses LayerStack's format util to format dates and numbers.

We have plans to add a settings() context similar to Svelte UX to control this globally (as well as setting default props and global styling refinements).

Until settings is added, you can override the defaultLocale exported from @layerstack/utils

import { createLocaleSettings, defaultLocale } from '@layerstack/utils';

export function localizeLayerChart() {
    Object.assign(
        defaultLocale,
        createLocaleSettings({
            locale: 'es',
            formats: { ... }
        })
    )
}

You can also format on a per-chart / component basis:

<script>
  import { format } from '@layerstack/utils';
</script>

<Axis format={x => format(x, { locale: 'es' })} />

Discussion

techniq avatar Jun 30 '25 13:06 techniq