feat: ship the interface in eight languages, with per-language plurals and mirroring
This commit is contained in:
parent
6de6672ae3
commit
a4a49f41d7
28 changed files with 1795 additions and 32 deletions
|
|
@ -82,6 +82,7 @@ class ReaderSettings extends Table {
|
|||
RealColumn get fontScale => real().withDefault(const Constant(1.0))();
|
||||
TextColumn get themeMode => text().withDefault(const Constant('system'))();
|
||||
TextColumn get variant => text().withDefault(const Constant('site'))();
|
||||
TextColumn get language => text().withDefault(const Constant('system'))();
|
||||
|
||||
@override
|
||||
Set<Column> get primaryKey => {id};
|
||||
|
|
@ -116,13 +117,27 @@ class MewsDatabase extends _$MewsDatabase {
|
|||
MewsDatabase.test(super.executor);
|
||||
|
||||
@override
|
||||
int get schemaVersion => 2;
|
||||
int get schemaVersion => 3;
|
||||
|
||||
/// Pre-release: the entry store replaces the old list of seen entry URLs and
|
||||
/// the library tables gain real primary keys, so an existing database is
|
||||
/// recreated rather than migrated.
|
||||
@override
|
||||
MigrationStrategy get migration => destructiveFallback;
|
||||
MigrationStrategy get migration => MigrationStrategy(
|
||||
onCreate: (m) => m.createAll(),
|
||||
onUpgrade: (m, from, to) async {
|
||||
// Version 1 predates the entry store and the library tables' real
|
||||
// primary keys. Nothing of it is worth carrying, so it is recreated;
|
||||
// later versions only gain columns and keep what the reader has.
|
||||
if (from < 2) {
|
||||
for (final entity in allSchemaEntities.toList().reversed) {
|
||||
await m.drop(entity);
|
||||
}
|
||||
await m.createAll();
|
||||
return;
|
||||
}
|
||||
if (from < 3) {
|
||||
await m.addColumn(readerSettings, readerSettings.language);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
static QueryExecutor _open() => LazyDatabase(() async {
|
||||
final dir = await getApplicationDocumentsDirectory();
|
||||
|
|
@ -522,6 +537,7 @@ class MewsDatabase extends _$MewsDatabase {
|
|||
required double fontScale,
|
||||
required String themeMode,
|
||||
required String variant,
|
||||
required String language,
|
||||
}) =>
|
||||
into(readerSettings).insert(
|
||||
ReaderSettingsCompanion.insert(
|
||||
|
|
@ -530,6 +546,7 @@ class MewsDatabase extends _$MewsDatabase {
|
|||
fontScale: Value(fontScale),
|
||||
themeMode: Value(themeMode),
|
||||
variant: Value(variant),
|
||||
language: Value(language),
|
||||
),
|
||||
mode: InsertMode.insertOrReplace);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue