Commit faf2e81
committed
feat(ls,du,df): add thousands separator support with locale-aware formatting
Implements thousands separator formatting for ls, du, and df commands with
support for leading quote format specifier. Adds comprehensive locale handling
using ICU4X when available, with fallback implementations for common locales.
Core changes:
- Add get_thousands_separator() with ICU4X support and locale caching
- Implement fallback logic for French (U+202F), English (comma), and POSIX
- Add leading quote format support to df, du, and ls
- Include locale-specific test helpers with cache bypass
Fixes:
- French locale (fr_*) now returns correct U+202F separator instead of '.'
- English locale (en_*) fallback now returns ',' instead of '\0'
- POSIX locale detection uses direct constant comparison for reliability
- Default return value correctly returns '\0' for unavailable locales
Dependencies:
- Add icu_decimal and serial_test for locale testing
- Update Cargo.lock with new dependencies
Tests:
- Add comprehensive locale and format tests for df, du, ls
- Include tests for thousands separator edge cases and locale handling1 parent efa1aa7 commit faf2e81
16 files changed
Lines changed: 980 additions & 59 deletions
File tree
- .vscode/cspell.dictionaries
- src
- uucore
- src/lib/features
- format
- i18n
- parser
- uu
- df
- src
- du/src
- ls/src
- tests/by-util
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
363 | 363 | | |
364 | 364 | | |
365 | 365 | | |
| 366 | + | |
| 367 | + | |
366 | 368 | | |
367 | 369 | | |
368 | 370 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
362 | 362 | | |
363 | 363 | | |
364 | 364 | | |
| 365 | + | |
365 | 366 | | |
366 | 367 | | |
367 | 368 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
23 | 29 | | |
24 | 30 | | |
25 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| |||
160 | 162 | | |
161 | 163 | | |
162 | 164 | | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
163 | 172 | | |
164 | 173 | | |
165 | 174 | | |
| |||
191 | 200 | | |
192 | 201 | | |
193 | 202 | | |
194 | | - | |
| 203 | + | |
195 | 204 | | |
196 | 205 | | |
197 | | - | |
| 206 | + | |
| 207 | + | |
198 | 208 | | |
199 | 209 | | |
200 | | - | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
201 | 214 | | |
202 | 215 | | |
203 | 216 | | |
204 | 217 | | |
205 | | - | |
206 | | - | |
207 | | - | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
208 | 227 | | |
209 | | - | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
210 | 232 | | |
211 | 233 | | |
212 | 234 | | |
213 | | - | |
| 235 | + | |
214 | 236 | | |
215 | 237 | | |
216 | | - | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
217 | 244 | | |
218 | 245 | | |
219 | 246 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
| 65 | + | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
96 | 99 | | |
97 | 100 | | |
98 | 101 | | |
| |||
160 | 163 | | |
161 | 164 | | |
162 | 165 | | |
163 | | - | |
| 166 | + | |
164 | 167 | | |
165 | 168 | | |
166 | 169 | | |
| |||
0 commit comments