translate default deck config name
This commit is contained in:
parent
d342955830
commit
dfa1ce6429
@ -1,7 +1,8 @@
|
||||
# Used in the deck configuration screen to show how many decks are used
|
||||
# by a particular configuration group, eg "Group1 (used by 3 decks)"
|
||||
deck-config-used-by-decks = used by { $decks ->
|
||||
[one] 1 deck
|
||||
*[other] {$decks} decks
|
||||
}
|
||||
|
||||
deck-config-used-by-decks =
|
||||
used by { $decks ->
|
||||
[one] 1 deck
|
||||
*[other] { $decks } decks
|
||||
}
|
||||
deck-config-default-name = Default
|
||||
|
@ -18,7 +18,7 @@ pub fn open_collection<P: Into<PathBuf>>(
|
||||
log: Logger,
|
||||
) -> Result<Collection> {
|
||||
let col_path = path.into();
|
||||
let storage = SqliteStorage::open_or_create(&col_path)?;
|
||||
let storage = SqliteStorage::open_or_create(&col_path, &i18n)?;
|
||||
|
||||
let col = Collection {
|
||||
storage,
|
||||
|
@ -115,12 +115,13 @@ impl super::SqliteStorage {
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use crate::{card::Card, storage::SqliteStorage};
|
||||
use crate::{card::Card, i18n::I18n, log, storage::SqliteStorage};
|
||||
use std::path::Path;
|
||||
|
||||
#[test]
|
||||
fn add_card() {
|
||||
let storage = SqliteStorage::open_or_create(Path::new(":memory:")).unwrap();
|
||||
let i18n = I18n::new(&[""], "", log::terminal());
|
||||
let storage = SqliteStorage::open_or_create(Path::new(":memory:"), &i18n).unwrap();
|
||||
let mut card = Card::default();
|
||||
storage.add_card(&mut card).unwrap();
|
||||
let id1 = card.id;
|
||||
|
@ -5,6 +5,7 @@ use super::SqliteStorage;
|
||||
use crate::{
|
||||
deckconf::{DeckConf, DeckConfID},
|
||||
err::Result,
|
||||
i18n::{FString, I18n},
|
||||
};
|
||||
use rusqlite::{params, NO_PARAMS};
|
||||
use std::collections::HashMap;
|
||||
@ -71,9 +72,10 @@ impl SqliteStorage {
|
||||
|
||||
// Creating/upgrading/downgrading
|
||||
|
||||
pub(super) fn add_default_deck_config(&self) -> Result<()> {
|
||||
pub(super) fn add_default_deck_config(&self, i18n: &I18n) -> Result<()> {
|
||||
let mut conf = DeckConf::default();
|
||||
conf.id.0 = 1;
|
||||
conf.name = i18n.tr(FString::DeckConfigDefaultName).into();
|
||||
self.add_deck_conf(&mut conf)
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@ use crate::notetypes::NoteTypeID;
|
||||
use crate::timestamp::{TimestampMillis, TimestampSecs};
|
||||
use crate::{
|
||||
decks::Deck,
|
||||
i18n::I18n,
|
||||
notetypes::NoteType,
|
||||
sched::cutoff::{sched_timing_today, SchedTimingToday},
|
||||
text::without_combining,
|
||||
@ -156,7 +157,7 @@ fn trace(s: &str) {
|
||||
}
|
||||
|
||||
impl SqliteStorage {
|
||||
pub(crate) fn open_or_create(path: &Path) -> Result<Self> {
|
||||
pub(crate) fn open_or_create(path: &Path, i18n: &I18n) -> Result<Self> {
|
||||
let db = open_or_create_collection_db(path)?;
|
||||
let (create, ver) = schema_version(&db)?;
|
||||
if ver > SCHEMA_MAX_VERSION {
|
||||
@ -193,7 +194,7 @@ impl SqliteStorage {
|
||||
}
|
||||
|
||||
if create {
|
||||
storage.add_default_deck_config()?;
|
||||
storage.add_default_deck_config(i18n)?;
|
||||
}
|
||||
|
||||
if create || upgrade {
|
||||
|
Loading…
Reference in New Issue
Block a user