Skip to content

Commit f84cb5f

Browse files
fkworldazat-io
authored andcommittedNov 19, 2024
feat: add locales option for all rules
1 parent e240971 commit f84cb5f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+681
-0
lines changed
 

‎docs/content/guide/getting-started.mdx

+1
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ In settings you can set the following options:
145145
- `ignoreCase` — Ignore case when sorting.
146146
- `ignorePattern` — Ignore sorting for elements that match the pattern.
147147
- `specialCharacters` — Control whether special characters should be kept, trimmed or removed before sorting. Values can be `'keep'`, `'trim'` or `'remove'`.
148+
- `locales` - The locales of sorting. Values can be a string with a BCP 47 language tag, or an array of such strings. See [String.prototype.localeCompare() - locales](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare#locales).
148149
- `partitionByComment` — Partition the sorted elements by comments. Values can be `true`, `false` or regexp pattern.
149150
- `partitionByNewLine` — Partition the sorted elements by new lines. Values can be `true` or `false`.
150151

‎docs/content/rules/sort-array-includes.mdx

+10
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,16 @@ Controls whether special characters should be trimmed, removed or kept before so
157157
- `'trim'` — Trim special characters when sorting alphabetically or naturally (e.g., “_a” and “a” are the same).
158158
- `'remove'` — Remove special characters when sorting (e.g., “/a/b” and “ab” are the same).
159159

160+
### locales
161+
162+
<sub>default: `'en-US'`</sub>
163+
164+
Specifies the sorting locales. See [String.prototype.localeCompare() - locales](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare#locales).
165+
166+
- `string` — A BCP 47 language tag (e.g. `'en'`, `'en-US'`, `'zh-CN'`).
167+
- `string[]` — An array of BCP 47 language tags.
168+
169+
**Note:** Only effective when `type` is `alphabetical`.
160170

161171
### groupKind
162172

0 commit comments

Comments
 (0)
Please sign in to comment.