Add global "locale" config option and make key-ordering rule locale-aware
Support sorting by locale with strcoll(). Properly handle case and accents. Note: this is a second implementation, for context see: https://github.com/adrienverge/yamllint/pull/280 https://github.com/adrienverge/yamllint/issues/285 https://github.com/adrienverge/yamllint/pull/288
This commit is contained in:
@@ -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.
|
||||
|
||||
Currently this only affects the ``key-ordering`` rule. The default will order
|
||||
by Unicode code point number, while locales will sort case and accents
|
||||
properly as well.
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
extends: default
|
||||
|
||||
locale: en_US.UTF-8
|
||||
|
||||
Reference in New Issue
Block a user