#!/bin/sh # Display a list of country codes and # corresponding country name from locale database # License: LGPLv2 locale -a | grep _ | #don't show nationalities uniq -w5 | #merge available charmaps while read lang { echo -ne "$lang\t"; global locale_info := $[env LANG=$lang locale territory language !2 >/dev/null] echo $locale_info | sed 's/\(.*\) \(.*\)/\1 (\2)/' } | sort -k2 #add -u to merge languages (CommandList children: [ (Pipeline children: [ (C {(locale)} {(-a)}) (C {(grep)} {(_)}) (C {(uniq)} {(-w5)}) (While cond: [(Sentence child:(C {(read)} {(lang)}) terminator:)] body: (DoGroup children: [ (Sentence child: (C {(echo)} {(-ne)} {(DQ ($ VSub_Name "$lang") (EscapedLiteralPart token:))} ) terminator: ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:locale_info) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (SimpleCommand words: [{(locale)} {(territory)} {(language)}] redirects: [ (Redir op_id: Redir_Great fd: 2 arg_word: {(/dev/null)} spids: [71] ) ] more_env: [ (env_pair name: LANG val: {($ VSub_Name "$lang")} spids: [62] ) ] ) ] ) left_token: spids: [61 73] ) } spids: [60] ) ] spids: [60] ) (Pipeline children: [ (C {(echo)} {($ VSub_Name "$locale_info")}) (C {(sed)} {(SQ <"s/\\(.*\\) \\(.*\\)/\\1 (\\2)/">)}) ] negated: False ) ] spids: [46 88] ) ) (C {(sort)} {(-k2)}) ] negated: False ) ] )