Skip to content

Intl support #583

@techniq

Description

@techniq

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    Todo

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions