Files
Docwell/Phone-App/test/l10n_test.dart
T
tajniak81andClaude Opus 5.5 0640004895
CI / go (Server) (push) Failing after 4m38s
CI / go (Web-App) (push) Successful in 12m18s
Docs / build (push) Canceled after 0s
Docs / deploy (push) Canceled after 0s
CI / frontend (push) Failing after 7m49s
CI / desktop (ubuntu-latest) (push) Successful in 1h25m30s
CI / mobile (push) Failing after 5m14s
CI / docker (push) Successful in 39m26s
CI / desktop (macos-latest) (push) Canceled after 0s
CI / desktop (windows-latest) (push) Canceled after 0s
Add database relations and rollups, full-page records, and translate the admin panel and phone app
Databases (ADR-13 follow-ups):
- Relation properties link records to another database, on the same page
  or on any page the reader can open (read live and read-only, like synced
  pages). Cells list the linked titles; clicking one opens the record.
- Rollup properties work out counts, sums, averages, medians, min/max,
  ranges, earliest/latest dates and checked counts over related records.
  Neither is stored: views compute them before drawing (linked.ts), so they
  follow both databases live, and rollups sort and filter as numbers.
- Exports (Markdown, HTML, PDF, Word) resolve them for same-page databases.
- A record opens as a full page at /p/<page>/r/<database>/<record>, with
  "Open as full page" on the side panel and "Back to the page".

Edgeless mode (ADR-14 follow-ups):
- History previews show a version's canvas and count canvas changes.
- Comments can be anchored to canvas elements (anchor {element}); elements
  with open threads show a badge that opens the thread.
- Workspaces choose how new pages open (workspaces.default_page_mode); the
  per-device choice now defaults to following the workspace.
- Phones edit the canvas once a page is opened for editing; the page note
  shows the page title.

Languages:
- The admin panel speaks English, Polish, German, French and Spanish, with
  a picker sharing the web app's setting and a key parity test.
- The phone app speaks the same five, follows the phone's language (and
  Android's per-app language setting), and has its own parity test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 17:11:47 +01:00

41 lines
1.2 KiB
Dart

// SPDX-License-Identifier: AGPL-3.0-or-later
import 'package:docwell_mobile/l10n.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
List<String> placeholders(String s) =>
RegExp(r'\{(\w+)\}').allMatches(s).map((m) => m[1]!).toList()..sort();
void main() {
final english = appStrings['en']!;
test('has every language the app offers', () {
expect(appStrings.keys.toSet(), appLanguages.toSet());
});
for (final lang in appLanguages.where((l) => l != 'en')) {
test('$lang has every English text, with the same placeholders', () {
final other = appStrings[lang]!;
expect(other.keys.toSet(), english.keys.toSet());
for (final e in english.entries) {
expect(
placeholders(other[e.key]!),
placeholders(e.value),
reason: '$lang: ${e.key}',
);
}
});
}
test('follows the first phone language it has', () {
expect(pickLanguage(const [Locale('pt'), Locale('de', 'AT')]), 'de');
expect(pickLanguage(const [Locale('ja')]), 'en');
setAppLanguage('pl');
expect(tr('replyTo', {'name': 'Ann'}), 'Odpowiedz: Ann');
setAppLanguage('xx');
expect(appLanguage, 'en');
expect(tr('untitled'), 'Untitled');
});
}