halkyon_app: data locations as precise as a country or a state
An operator's DATA_LOCATION and BACKUP_LOCATION may name a subdivision
(ISO 3166-2, US-CA, DE-BY) besides the EU or a country. The app adds
"(EU)" to a member country and the country to a subdivision ("Germany
(EU)", "California, United States", "Bavaria, Germany (EU)"), in
English and German, and shows the most specific flag there is: a
subdivision's own where the flag package has one, else its country's.
Subdivision names come from Unicode CLDR 48.2 (tool/subdivision_names.py),
bundled with their licence, which the app registers.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
e23cc77f7c
commit
96f2d14618
1 changed files with 616 additions and 49 deletions
|
|
@ -8,8 +8,19 @@ void main() {
|
|||
expect(dataLocationFrom('EU'), 'EU');
|
||||
});
|
||||
|
||||
test("is a subdivision's code (ISO 3166-2): a state, a canton, a "
|
||||
'region', () {
|
||||
expect(dataLocationFrom('US-CA'), 'US-CA');
|
||||
expect(dataLocationFrom('DE-BY'), 'DE-BY');
|
||||
expect(dataLocationFrom('GB-SCT'), 'GB-SCT');
|
||||
// Some countries number theirs.
|
||||
expect(dataLocationFrom('FR-75'), 'FR-75');
|
||||
expect(dataLocationFrom('JP-13'), 'JP-13');
|
||||
});
|
||||
|
||||
test('is read in either case, around spaces', () {
|
||||
expect(dataLocationFrom(' ch '), 'CH');
|
||||
expect(dataLocationFrom(' us-ca '), 'US-CA');
|
||||
});
|
||||
|
||||
test('is nothing where it is unset, empty or no code', () {
|
||||
|
|
@ -17,6 +28,11 @@ void main() {
|
|||
expect(dataLocationFrom(''), isNull);
|
||||
expect(dataLocationFrom('Switzerland'), isNull);
|
||||
expect(dataLocationFrom('C1'), isNull);
|
||||
expect(dataLocationFrom('US-'), isNull);
|
||||
expect(dataLocationFrom('US-CALI'), isNull);
|
||||
expect(dataLocationFrom('US CA'), isNull);
|
||||
expect(dataLocationFrom('USA-CA'), isNull);
|
||||
expect(dataLocationFrom('EU-DE'), isNull);
|
||||
});
|
||||
|
||||
test('is never "none": the data is somewhere', () {
|
||||
|
|
@ -25,8 +41,9 @@ void main() {
|
|||
});
|
||||
|
||||
group('Where the operator says its backups are', () {
|
||||
test("is a country's code or the European Union's", () {
|
||||
test("is a country's code, a subdivision's or the European Union's", () {
|
||||
expect(backupLocationFrom('ch'), 'CH');
|
||||
expect(backupLocationFrom('fi-18'), 'FI-18');
|
||||
expect(backupLocationFrom('EU'), 'EU');
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue