Created
November 3, 2025 10:39
-
-
Save sodiboo/8e63cda36159474c830f2d409dc02f5e to your computer and use it in GitHub Desktop.
parsing pure-rust-locales and filtering for the good ones
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| git clone https://github.com/chronotope/pure-rust-locales | |
| cd pure-rust-locales | |
| rustdoc src/lib.rs -Z unstable-options --output-format json | |
| let lib = open doc/lib.json | |
| let items = $lib.index | columns | each {into int} | math max | 0..$in | each {|e| {index: $e, item: ($lib.index | get -o ($e | into string))} } | flatten | each { try { update inner { transpose -d kind content } } catch { {} } } | flatten inner | |
| def expand [] { let $i = $in; let item = $items | get $i; if $item.kind == "use" { $item.content.id | expand | update name $item.content.name } else { $item } } | |
| def transpose_members_map [f] { each { [ $in.name ($in | do $f) ] } | into record } | |
| let locales = $items | get $lib.root | get content.items | each { expand } | where kind == "module" | select name content | update content { get items | each { expand } | transpose_members_map { get content.items | each { expand } | transpose_members_map { get docs | str trim -c "`" } } } | flatten | rename -c {name:index} | |
| $locales | where LC_TIME.D_FMT in ['%F' '"%Y-%m-%d"'] and LC_TIME.T_FMT in ['"%T"' '"%H:%M:%S"' '"%R:%S"'] and LC_NUMERIC.DECIMAL_POINT == '"."' |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://gaysex.cloud/notes/aekv5pqzsmo10omm