Skip to content

Latest commit

 

History

History
64 lines (46 loc) · 1.61 KB

README.md

File metadata and controls

64 lines (46 loc) · 1.61 KB

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