# Number and Time Locales Locales control how Vega formats certian values. `format_locale` sets number formatting options such as decimal marks, digit grouping, and currency symbols. `time_format_locale` sets the names and patterns used for dates and times. Use a built-in locale name such as `de-DE` or `ja-JP` for standard regional formats, or pass a locale object for custom rules. The built-in names match the locale files in [d3-format](https://github.com/d3/d3-format/tree/main/locale) and [d3-time-format](https://github.com/d3/d3-time-format/tree/main/locale). Locales change formatting only. They do not change the timezone or the data. ## Use a Built-In Locale This chart uses `de-DE` (German language) as both the number and time locale. This alters the display of the `$,.0f` numeric format pattern on the y-axis and the display of month names on the x-axis. Save this specification: :::{dropdown} chart.vl.json :open: ```{literalinclude} /_examples/locale-demo.vl.json :language: json ``` ::: ```python from pathlib import Path import vl_convert as vlc spec = Path("chart.vl.json").read_text(encoding="utf-8") svg = vlc.vegalite_to_svg( spec, format_locale="de-DE", time_format_locale="de-DE", ) Path("chart.svg").write_text(svg, encoding="utf-8") ``` Rendered with `de-DE` locale for both settings, the y-axis groups thousands with a dot and places the euro sign after the number, and the x-axis uses German month names: ```{vl-chart} /_examples/locale-demo.vl.json :format-locale: de-DE :time-format-locale: de-DE :alt: Line chart of monthly revenue with German number and month formatting ``` ## Define Custom Number Rules A number locale follows the [d3-format locale definition](https://d3js.org/d3-format#locale_format). Save this example as `format-locale.json`: :::{dropdown} format-locale.json :open: ```json { "decimal": ",", "thousands": ".", "grouping": [3], "currency": ["", " EUR"] } ``` ::: Pass the equivalent dictionary: ```python format_locale = { "decimal": ",", "thousands": ".", "grouping": [3], "currency": ["", " EUR"], } svg = vlc.vegalite_to_svg(spec, format_locale=format_locale) ``` Custom time locales follow the [d3-time-format locale definition](https://d3js.org/d3-time-format#locale_format) and define day and month names as well as date and time patterns. Prefer a built-in name when one fits. `get_format_locale()` and `get_time_format_locale()` return the definition of a built-in locale, and {doc}`../api-reference` lists the accepted names. See {doc}`../advanced/configuration` to apply a locale to every conversion by default.