Add global "locale" config option and make key-ordering rule locale-aware

Support sorting by locale with strcoll(). Properly handle case and accents.
This commit is contained in:
Wolfgang Walther
2020-07-15 11:46:05 +02:00
committed by GitHub
parent a2218988ee
commit 9e90c777cb
6 changed files with 138 additions and 16 deletions

View File

@@ -189,3 +189,22 @@ Here is a more complex example:
ignore: |
*.ignore-trailing-spaces.yaml
ascii-art/*
Setting the locale
------------------
It is possible to set the ``locale`` option globally. This is passed to Python's
`locale.setlocale
<https://docs.python.org/3/library/locale.html#locale.setlocale>`_,
so an empty string ``""`` will use the system default locale, while e.g.
``"en_US.UTF-8"`` will use that. If unset, the default is ``"C.UTF-8"``.
Currently this only affects the ``key-ordering`` rule. The default will order
by Unicode code point number, while other locales will sort case and accents
properly as well.
.. code-block:: yaml
extends: default
locale: en_US.UTF-8