What Learn and Todo each held now comes from halkyon_app: - AccountTiles: whose account on which instance, switching, signing out (asking first for an anonymous account, as it deletes it) and deleting it (asking first), the app's own words passed in. - showAppAbout: the app's name, version, icon and legalese as it gives them, the source of what the instance runs (AppDependencies gains sourceCodeUrl), the app's own parts, the licence list. - resolveAppLocale: the first preferred language the app speaks, never by country alone, British English otherwise. - AssetCountryNames, the default of InstanceGate and InstanceScope: Unicode CLDR 48.2's territory names in English and German (tool/country_names.py, 7.6 KB), Hong Kong, Macao, Myanmar and Palestine by their short names as Learn's world map has them, so Todo says "Germany (EU)" where it said "DE (EU)". Learn's texts read as before in every language; its About bloc and gateway, its country names from the world map and the keys only the moved code used are gone, as are Todo's copies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
58 lines
2 KiB
Dart
58 lines
2 KiB
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:halkyon_app/halkyon_app.dart';
|
|
import 'package:material_ui/material_ui.dart';
|
|
|
|
void main() {
|
|
/// The languages a Halkyon app speaks: British English (the template, as
|
|
/// `en` and `en-GB`), American English and German.
|
|
const supported = [
|
|
Locale('en'),
|
|
Locale('de'),
|
|
Locale('en', 'GB'),
|
|
Locale('en', 'US'),
|
|
];
|
|
|
|
Locale resolved(List<Locale>? preferred) =>
|
|
resolveAppLocale(preferred, supported);
|
|
|
|
test('the language asked for, where the app speaks it', () {
|
|
expect(resolved(const [Locale('en', 'US')]), const Locale('en', 'US'));
|
|
expect(resolved(const [Locale('en', 'GB')]), const Locale('en', 'GB'));
|
|
expect(resolved(const [Locale('de', 'DE')]), const Locale('de'));
|
|
expect(resolved(const [Locale('de')]), const Locale('de'));
|
|
});
|
|
|
|
test('British English for any other English', () {
|
|
expect(resolved(const [Locale('en')]), const Locale('en', 'GB'));
|
|
expect(resolved(const [Locale('en', 'AU')]), const Locale('en', 'GB'));
|
|
});
|
|
|
|
test('the next language the device prefers, where the first is none the '
|
|
'app speaks', () {
|
|
expect(
|
|
resolved(const [Locale('fr', 'FR'), Locale('de', 'AT')]),
|
|
const Locale('de'),
|
|
);
|
|
});
|
|
|
|
test('British English where the app speaks none of them', () {
|
|
expect(resolved(const [Locale('fr', 'FR')]), const Locale('en', 'GB'));
|
|
expect(resolved(const []), const Locale('en', 'GB'));
|
|
expect(resolved(null), const Locale('en', 'GB'));
|
|
});
|
|
|
|
test('never a language picked by the country alone', () {
|
|
// Spanish in the United States isn't American English.
|
|
expect(resolved(const [Locale('es', 'US')]), const Locale('en', 'GB'));
|
|
});
|
|
|
|
test('every language this package speaks is one it resolves to', () {
|
|
for (final locale in HalkyonAppLocalizations.supportedLocales) {
|
|
expect(
|
|
resolveAppLocale([locale], HalkyonAppLocalizations.supportedLocales),
|
|
isIn(HalkyonAppLocalizations.supportedLocales),
|
|
reason: '$locale',
|
|
);
|
|
}
|
|
});
|
|
}
|