Skip to content

svkau/datasette-localized-numbers

datasette-localized-numbers

Changelog Tests License

Uses Babel to add some localisation features to Datasette.

  • Render formatted cell-values, e.g. 1234567 > 1 234 567 and 1234567 > 1 234 567,00 kr
  • Filters for Ninja2 to show localized numbers.
  • Custom SQL functions.

Installation

Install this plugin in the same environment as Datasette.

datasette install datasette-localized-numbers

Usage

Render localized number and currency

Filter for Ninja2 templates

(sv_SE only!)

{{ value|localized_number }}

{{ value|localized_currency }}

Custom SQL function

(sv_SE only!)

SELECT(localized_number(1234567))

Result: "1 234 567"

SELECT(localized_currency(1234567))

Result: "1 234 567,00 kr"

Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:

cd datasette-localized-numbers
python3 -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

pip install -e '.[test]'

To run the tests:

pytest

About

A plugin for Datasette

Resources

License

Apache-2.0, BSD-3-Clause licenses found

Licenses found

Apache-2.0
LICENSE
BSD-3-Clause
Babel_LICENSE.txt

Stars

Watchers

Forks

Packages

No packages published

Languages