init mtxchat::locales from mtxcli::locales

This commit is contained in:
nworbnhoj 2023-07-30 06:41:19 +10:00
parent 162a9faa2b
commit 0257ea6b31
4 changed files with 283 additions and 74 deletions

View file

@ -0,0 +1,221 @@
{
"mtxchat.clock.warning": {
"en": "WARNING: clock not set",
"en-tts": "WARNING: clock not set",
"fr": "AVERTISSEMENT : horloge non réglée",
"ja": "WARNING: clock not set *EN*",
"zh": "WARNING: clock not set *EN*"
},
"mtxchat.filter.failed": {
"en": "error: could not create filter",
"en-tts": "error: could not create filter",
"fr": "erreur: impossible de créer un filtre *MT*",
"ja": "error: could not create filter *EN*",
"zh": "error: could not create filter *EN*"
},
"mtxchat.get.help": {
"en": "/get key",
"en-tts": "get key",
"fr": "/get clé",
"ja": "/get key *EN*",
"zh": "/get key *EN*"
},
"mtxchat.greeting": {
"en": "Welcome to the MTXCHAT demo. Type /help for available commands",
"en-tts": "Welcome to the simple MTXCHAT demo. Type /help for available commands",
"fr": "Bienvenue à la démo simple de MTXCHAT. Tapez /help pour les commandes disponibles",
"ja": "シンプルなMTXCHATデモへようこそ",
"zh": "简单的 mtxcli 演示活动"
},
"mtxchat.heap.help": {
"en": "/heap",
"en-tts": "heap",
"fr": "/heap",
"ja": "/heap",
"zh": "/heap"
},
"mtxchat.help.help": {
"en": "/help [cmd]",
"en-tts": "help [cmd]",
"fr": "/help [cmd]",
"ja": "/help [cmd] *EN*",
"zh": "/help [cmd] *EN*"
},
"mtxchat.help.overview": {
"en": "available mtxcli commands:",
"en-tts": "available mtxcli commands:",
"fr": "commandes mtxcli disponibles:",
"ja": "available mtxcli commands: *EN*",
"zh": "available mtxcli commands: *EN*"
},
"mtxchat.initialized": {
"en": "MTXCHAT ready",
"en-tts": "MTXCHAT ready",
"fr": "MTXCHAT prêt",
"ja": "MTXCHAT ready *EN*",
"zh": "MTXCHAT ready *EN*"
},
"mtxchat.logged.in": {
"en": "logged in",
"en-tts": "logged in",
"fr": "connecté",
"ja": "logged in *EN*",
"zh": "logged in *EN*"
},
"mtxchat.logged.out": {
"en": "logged out",
"en-tts": "logged out",
"fr": "déconnecté",
"ja": "logged out *EN*",
"zh": "logged out *EN*"
},
"mtxchat.logging.in": {
"en": "logging in...",
"en-tts": "logging in",
"fr": "connexion...",
"ja": "logging in... *EN*",
"zh": "logging in... *EN*"
},
"mtxchat.login.failed": {
"en": "authentication failed",
"en-tts": "authentication failed",
"fr": "échec de l'authentification",
"ja": "authentication failed *EN*",
"zh": "authentication failed *EN*"
},
"mtxchat.login.help": {
"en": "/login",
"en-tts": "login",
"fr": "/login (connexion)",
"ja": "/login *EN*",
"zh": "/login *EN*"
},
"mtxchat.logout.help": {
"en": "/logout",
"en-tts": "logout",
"fr": "/logout (déconnexion)",
"ja": "/logout *EN*",
"zh": "/logout *EN*"
},
"mtxchat.migration.completed": {
"en": "migration completed",
"en-tts": "migration completed",
"fr": "migration terminée",
"ja": "migration completed *EN*",
"zh": "migration completed *EN*"
},
"mtxchat.migrations.complete": {
"en": "migrations complete",
"en-tts": "migrations complete",
"fr": "tous les migrations terminées",
"ja": "migrations complete *EN*",
"zh": "migrations complete *EN*"
},
"mtxchat.not.connected": {
"en": "not connected",
"en-tts": "not conntected",
"fr": "déconnecté",
"ja": "not connected *EN*",
"zh": "not connected *EN*"
},
"mtxchat.pddb.warning": {
"en": "WARNING: pddb not mounted",
"en-tts": "WARNING: pddb not mounted",
"fr": "AVERTISSEMENT: pddb pas monté",
"ja": "WARNING: pddb not mounted *EN*",
"zh": "WARNING: pddb not mounted *EN*"
},
"mtxchat.login.title": {
"en": "Matrix /login",
"en-tts": "Matrix /login"
},
"mtxchat.password": {
"en": "password",
"en-tts": "password",
"fr": "de-passe",
"ja": "password *EN*",
"zh": "password *EN*"
},
"mtxchat.please.set.room": {
"en": "please /set room #my-room-to-join",
"en-tts": "please /set room #my-room-to-join",
"fr": "Veuillez /set room #ma-chambre",
"ja": "please /set room #my-room-to-join *EN*",
"zh": "please /set room #my-room-to-join *EN*"
},
},
"mtxchat.server": {
"en": "server",
"en-tts": "server"
},
"mtxchat.username": {
"en": "username",
"en-tts": "username",
"fr": "utilisateur",
"ja": "username *EN*",
"zh": "username *EN*"
},
"mtxchat.roomid.failed": {
"en": "error: could not find room_id",
"en-tts": "error: could not find room_id",
"fr": "erreur: impossible de trouver chambre",
"ja": "error: could not find room_id *EN*",
"zh": "error: could not find room_id *EN*"
},
"mtxchat.running.migrations": {
"en": "Running migrations from version",
"en-tts": "Running migrations from version",
"fr": "Exécution des migrations à partir de la version",
"ja": "Running migrations from version *EN*",
"zh": "Running migrations from version *EN*"
},
"mtxchat.send.failed": {
"en": "failed to send!",
"en-tts": "failed to send!",
"fr": "n'a pas envoyé!",
"ja": "failed to send! *EN*",
"zh": "failed to send! *EN*"
},
"mtxchat.set.help": {
"en": "/set key value",
"en-tts": "set key value",
"fr": "/set clé valeur",
"ja": "/set key value *EN*",
"zh": "/set key value *EN*"
},
"mtxchat.status.help": {
"en": "/status",
"en-tts": "status",
"fr": "/status (statut)",
"ja": "/status *EN*",
"zh": "/status *EN*"
},
"mtxchat.unknown.help": {
"en": "unknown command",
"en-tts": "unknown command",
"fr": "commande inconnue",
"ja": "unknown command *EN*",
"zh": "unknown command *EN*"
},
"mtxchat.unset.help": {
"en": "/unset key",
"en-tts": "unset key",
"fr": "/unset clé",
"ja": "/unset key *EN*",
"zh": "/unset key *EN*"
},
"mtxchat.wifi.connected": {
"en": "WiFi connected",
"en-tts": "WiFi connected",
"fr": "WiFi connecté",
"ja": "WiFi connected *EN*",
"zh": "WiFi connected *EN*"
},
"mtxchat.wifi.warning": {
"en": "WARNING: WiFi not connected",
"en-tts": "WARNING: WiFi not connected",
"fr": "AVERTISSEMENT: WiFi pas connecté",
"ja": "WARNING: WiFi not connected *EN*",
"zh": "WARNING: WiFi not connected *EN*"
}
}

View file

@ -301,11 +301,7 @@ impl MtxChat {
if !self.logged_in { if !self.logged_in {
if web::get_login_type(&self.server) { if web::get_login_type(&self.server) {
let user = self.get_default(USER_KEY, USER_KEY); let user = self.get_default(USER_KEY, USER_KEY);
if user.len() == 0 { if user.len() == 0 {}
self.modals
.show_notification(t!("mtxcli.please.set.user", locales::LANG), None)
.expect("notification failed");
}
let password = self.get_default(PASSWORD_KEY, EMPTY); let password = self.get_default(PASSWORD_KEY, EMPTY);
if password.len() == 0 { if password.len() == 0 {
} else { } else {
@ -323,10 +319,8 @@ impl MtxChat {
} }
} }
if self.logged_in { if self.logged_in {
// self.scalar_async_msg(LOGGED_IN_ID);
log::info!("logged_in"); log::info!("logged_in");
} else { } else {
// self.scalar_async_msg(LOGIN_FAILED_ID);
log::info!("login failed"); log::info!("login failed");
} }
self.logged_in self.logged_in
@ -334,18 +328,18 @@ impl MtxChat {
pub fn login_modal(&mut self) { pub fn login_modal(&mut self) {
const HIDE: &str = "*****"; const HIDE: &str = "*****";
let mut builder = self.modals.alert_builder("Matrix login."); let mut builder = self.modals.alert_builder(t!("mtxchat.login.title", locales::LANG));
let builder = match self.get(SERVER_KEY) { let builder = match self.get(SERVER_KEY) {
Ok(Some(server)) => builder.field_placeholder_persist(Some(server), None), Ok(Some(server)) => builder.field_placeholder_persist(Some(server), None),
_ => builder.field(Some("server".to_string()), None), _ => builder.field(Some(t!("mtxchat.server", locales::LANG).to_string()), None),
}; };
let builder = match self.get(USERNAME_KEY) { let builder = match self.get(USERNAME_KEY) {
Ok(Some(user)) => builder.field_placeholder_persist(Some(user), None), Ok(Some(user)) => builder.field_placeholder_persist(Some(user), None),
_ => builder.field(Some("username".to_string()), None), _ => builder.field(Some(t!("mtxchat.username", locales::LANG).to_string()), None),
}; };
let builder = match self.get(PASSWORD_KEY) { let builder = match self.get(PASSWORD_KEY) {
Ok(Some(pwd)) => builder.field_placeholder_persist(Some(HIDE.to_string()), None), Ok(Some(pwd)) => builder.field_placeholder_persist(Some(HIDE.to_string()), None),
_ => builder.field(Some("password".to_string()), None), _ => builder.field(Some(t!("mtxchat.password", locales::LANG).to_string()), None),
}; };
if let Ok(payloads) = builder.build() { if let Ok(payloads) = builder.build() {
let mut user = "@".to_string(); let mut user = "@".to_string();

View file

@ -73,7 +73,7 @@ fn wrapped_main() -> ! {
Some(Event::Focus) => { Some(Event::Focus) => {
while !mtxchat.login() { while !mtxchat.login() {
modals modals
.show_notification(t!("mtxcli.login.failed", locales::LANG), None) .show_notification(t!("mtxchat.login.failed", locales::LANG), None)
.expect("notification failed"); .expect("notification failed");
mtxchat.login_modal(); mtxchat.login_modal();
} }

View file

@ -1,222 +1,216 @@
{ {
"mtxcli.clock.warning": { "mtxchat.clock.warning": {
"en": "WARNING: clock not set", "en": "WARNING: clock not set",
"en-tts": "WARNING: clock not set", "en-tts": "WARNING: clock not set",
"fr": "AVERTISSEMENT : horloge non réglée", "fr": "AVERTISSEMENT : horloge non réglée",
"ja": "WARNING: clock not set *EN*", "ja": "WARNING: clock not set *EN*",
"zh": "WARNING: clock not set *EN*" "zh": "WARNING: clock not set *EN*"
}, },
"mtxcli.filter.failed": { "mtxchat.filter.failed": {
"en": "error: could not create filter", "en": "error: could not create filter",
"en-tts": "error: could not create filter", "en-tts": "error: could not create filter",
"fr": "erreur: impossible de créer un filtre *MT*", "fr": "erreur: impossible de créer un filtre *MT*",
"ja": "error: could not create filter *EN*", "ja": "error: could not create filter *EN*",
"zh": "error: could not create filter *EN*" "zh": "error: could not create filter *EN*"
}, },
"mtxcli.get.help": { "mtxchat.get.help": {
"en": "/get key", "en": "/get key",
"en-tts": "get key", "en-tts": "get key",
"fr": "/get clé", "fr": "/get clé",
"ja": "/get key *EN*", "ja": "/get key *EN*",
"zh": "/get key *EN*" "zh": "/get key *EN*"
}, },
"mtxcli.greeting": { "mtxchat.greeting": {
"en": "Welcome to the MTXCLI demo. Type /help for available commands", "en": "Welcome to the MTXCHAT demo. Type /help for available commands",
"en-tts": "Welcome to the simple MTXCLI demo. Type /help for available commands", "en-tts": "Welcome to the simple MTXCHAT demo. Type /help for available commands",
"fr": "Bienvenue à la démo simple de MTXCLI. Tapez /help pour les commandes disponibles", "fr": "Bienvenue à la démo simple de MTXCHAT. Tapez /help pour les commandes disponibles",
"ja": "シンプルなMTXCLIデモへようこそ", "ja": "シンプルなMTXCHATデモへようこそ",
"zh": "简单的 mtxcli 演示活动" "zh": "简单的 mtxchat 演示活动"
}, },
"mtxcli.heap.help": { "mtxchat.heap.help": {
"en": "/heap", "en": "/heap",
"en-tts": "heap", "en-tts": "heap",
"fr": "/heap", "fr": "/heap",
"ja": "/heap", "ja": "/heap",
"zh": "/heap" "zh": "/heap"
}, },
"mtxcli.help.help": { "mtxchat.help.help": {
"en": "/help [cmd]", "en": "/help [cmd]",
"en-tts": "help [cmd]", "en-tts": "help [cmd]",
"fr": "/help [cmd]", "fr": "/help [cmd]",
"ja": "/help [cmd] *EN*", "ja": "/help [cmd] *EN*",
"zh": "/help [cmd] *EN*" "zh": "/help [cmd] *EN*"
}, },
"mtxcli.help.overview": { "mtxchat.help.overview": {
"en": "available mtxcli commands:", "en": "available mtxcli commands:",
"en-tts": "available mtxcli commands:", "en-tts": "available mtxcli commands:",
"fr": "commandes mtxcli disponibles:", "fr": "commandes mtxcli disponibles:",
"ja": "available mtxcli commands: *EN*", "ja": "available mtxcli commands: *EN*",
"zh": "available mtxcli commands: *EN*" "zh": "available mtxcli commands: *EN*"
}, },
"mtxcli.initialized": { "mtxchat.initialized": {
"en": "MTXCLI ready", "en": "MTXCHAT ready",
"en-tts": "MTXCLI ready", "en-tts": "MTXCHAT ready",
"fr": "MTXCLI prêt", "fr": "MTXCHAT prêt",
"ja": "MTXCLI ready *EN*", "ja": "MTXCHAT ready *EN*",
"zh": "MTXCLI ready *EN*" "zh": "MTXCHAT ready *EN*"
}, },
"mtxcli.logged.in": { "mtxchat.logged.in": {
"en": "logged in", "en": "logged in",
"en-tts": "logged in", "en-tts": "logged in",
"fr": "connecté", "fr": "connecté",
"ja": "logged in *EN*", "ja": "logged in *EN*",
"zh": "logged in *EN*" "zh": "logged in *EN*"
}, },
"mtxcli.logged.out": { "mtxchat.logged.out": {
"en": "logged out", "en": "logged out",
"en-tts": "logged out", "en-tts": "logged out",
"fr": "déconnecté", "fr": "déconnecté",
"ja": "logged out *EN*", "ja": "logged out *EN*",
"zh": "logged out *EN*" "zh": "logged out *EN*"
}, },
"mtxcli.logging.in": { "mtxchat.logging.in": {
"en": "logging in...", "en": "logging in...",
"en-tts": "logging in", "en-tts": "logging in",
"fr": "connexion...", "fr": "connexion...",
"ja": "logging in... *EN*", "ja": "logging in... *EN*",
"zh": "logging in... *EN*" "zh": "logging in... *EN*"
}, },
"mtxcli.login.failed": { "mtxchat.login.failed": {
"en": "authentication failed", "en": "authentication failed",
"en-tts": "authentication failed", "en-tts": "authentication failed",
"fr": "échec de l'authentification", "fr": "échec de l'authentification",
"ja": "authentication failed *EN*", "ja": "authentication failed *EN*",
"zh": "authentication failed *EN*" "zh": "authentication failed *EN*"
}, },
"mtxcli.login.help": { "mtxchat.login.help": {
"en": "/login", "en": "/login",
"en-tts": "login", "en-tts": "login",
"fr": "/login (connexion)", "fr": "/login (connexion)",
"ja": "/login *EN*", "ja": "/login *EN*",
"zh": "/login *EN*" "zh": "/login *EN*"
}, },
"mtxcli.logout.help": { "mtxchat.logout.help": {
"en": "/logout", "en": "/logout",
"en-tts": "logout", "en-tts": "logout",
"fr": "/logout (déconnexion)", "fr": "/logout (déconnexion)",
"ja": "/logout *EN*", "ja": "/logout *EN*",
"zh": "/logout *EN*" "zh": "/logout *EN*"
}, },
"mtxcli.migration.completed": { "mtxchat.migration.completed": {
"en": "migration completed", "en": "migration completed",
"en-tts": "migration completed", "en-tts": "migration completed",
"fr": "migration terminée", "fr": "migration terminée",
"ja": "migration completed *EN*", "ja": "migration completed *EN*",
"zh": "migration completed *EN*" "zh": "migration completed *EN*"
}, },
"mtxcli.migrations.complete": { "mtxchat.migrations.complete": {
"en": "migrations complete", "en": "migrations complete",
"en-tts": "migrations complete", "en-tts": "migrations complete",
"fr": "tous les migrations terminées", "fr": "tous les migrations terminées",
"ja": "migrations complete *EN*", "ja": "migrations complete *EN*",
"zh": "migrations complete *EN*" "zh": "migrations complete *EN*"
}, },
"mtxcli.not.connected": { "mtxchat.not.connected": {
"en": "not connected", "en": "not connected",
"en-tts": "not conntected", "en-tts": "not conntected",
"fr": "déconnecté", "fr": "déconnecté",
"ja": "not connected *EN*", "ja": "not connected *EN*",
"zh": "not connected *EN*" "zh": "not connected *EN*"
}, },
"mtxcli.pddb.warning": { "mtxchat.pddb.warning": {
"en": "WARNING: pddb not mounted", "en": "WARNING: pddb not mounted",
"en-tts": "WARNING: pddb not mounted", "en-tts": "WARNING: pddb not mounted",
"fr": "AVERTISSEMENT: pddb pas monté", "fr": "AVERTISSEMENT: pddb pas monté",
"ja": "WARNING: pddb not mounted *EN*", "ja": "WARNING: pddb not mounted *EN*",
"zh": "WARNING: pddb not mounted *EN*" "zh": "WARNING: pddb not mounted *EN*"
}, },
"mtxcli.please.login": { "mtxchat.login.title": {
"en": "please /login", "en": "Matrix /login",
"en-tts": "please /login", "en-tts": "Matrix /login"
"fr": "Veuillez /login",
"ja": "please /login *EN*",
"zh": "please /login *EN*"
}, },
"mtxcli.please.set.password": { "mtxchat.password": {
"en": "please /set password my-password", "en": "password",
"en-tts": "please /set password my-password", "en-tts": "password",
"fr": "Veuillez /set password mot-de-passe", "fr": "de-passe",
"ja": "please /set password my-password *EN*", "ja": "password *EN*",
"zh": "please /set password my-password *EN*" "zh": "password *EN*"
}, },
"mtxcli.please.set.room": { "mtxchat.please.set.room": {
"en": "please /set room #my-room-to-join", "en": "please /set room #my-room-to-join",
"en-tts": "please /set room #my-room-to-join", "en-tts": "please /set room #my-room-to-join",
"fr": "Veuillez /set room #ma-chambre", "fr": "Veuillez /set room #ma-chambre",
"ja": "please /set room #my-room-to-join *EN*", "ja": "please /set room #my-room-to-join *EN*",
"zh": "please /set room #my-room-to-join *EN*" "zh": "please /set room #my-room-to-join *EN*"
}, },
"mtxcli.please.set.server": { "mtxchat.server": {
"en": "please /set server https://matrix.org", "en": "server",
"en-tts": "please /set server https://matrix.org", "en-tts": "server"
"fr": "Veuillez /set server https://matrix.org",
"ja": "please /set server https://matrix.org *EN*",
"zh": "please /set server https://matrix.org *EN*"
}, },
"mtxcli.please.set.user": { "mtxchat.username": {
"en": "please /set user @USER:matrix.org", "en": "username",
"en-tts": "please /set user @USER:matrix.org", "en-tts": "username",
"fr": "Veuillez /set user @UTILISATEUR:matrix.org", "fr": "utilisateur",
"ja": "please /set user @USER:matrix.org *EN*", "ja": "username *EN*",
"zh": "please /set user @USER:matrix.org *EN*" "zh": "username *EN*"
}, },
"mtxcli.roomid.failed": { "mtxchat.roomid.failed": {
"en": "error: could not find room_id", "en": "error: could not find room_id",
"en-tts": "error: could not find room_id", "en-tts": "error: could not find room_id",
"fr": "erreur: impossible de trouver chambre", "fr": "erreur: impossible de trouver chambre",
"ja": "error: could not find room_id *EN*", "ja": "error: could not find room_id *EN*",
"zh": "error: could not find room_id *EN*" "zh": "error: could not find room_id *EN*"
}, },
"mtxcli.running.migrations": { "mtxchat.running.migrations": {
"en": "Running migrations from version", "en": "Running migrations from version",
"en-tts": "Running migrations from version", "en-tts": "Running migrations from version",
"fr": "Exécution des migrations à partir de la version", "fr": "Exécution des migrations à partir de la version",
"ja": "Running migrations from version *EN*", "ja": "Running migrations from version *EN*",
"zh": "Running migrations from version *EN*" "zh": "Running migrations from version *EN*"
}, },
"mtxcli.send.failed": { "mtxchat.send.failed": {
"en": "failed to send!", "en": "failed to send!",
"en-tts": "failed to send!", "en-tts": "failed to send!",
"fr": "n'a pas envoyé!", "fr": "n'a pas envoyé!",
"ja": "failed to send! *EN*", "ja": "failed to send! *EN*",
"zh": "failed to send! *EN*" "zh": "failed to send! *EN*"
}, },
"mtxcli.set.help": { "mtxchat.set.help": {
"en": "/set key value", "en": "/set key value",
"en-tts": "set key value", "en-tts": "set key value",
"fr": "/set clé valeur", "fr": "/set clé valeur",
"ja": "/set key value *EN*", "ja": "/set key value *EN*",
"zh": "/set key value *EN*" "zh": "/set key value *EN*"
}, },
"mtxcli.status.help": { "mtxchat.status.help": {
"en": "/status", "en": "/status",
"en-tts": "status", "en-tts": "status",
"fr": "/status (statut)", "fr": "/status (statut)",
"ja": "/status *EN*", "ja": "/status *EN*",
"zh": "/status *EN*" "zh": "/status *EN*"
}, },
"mtxcli.unknown.help": { "mtxchat.unknown.help": {
"en": "unknown command", "en": "unknown command",
"en-tts": "unknown command", "en-tts": "unknown command",
"fr": "commande inconnue", "fr": "commande inconnue",
"ja": "unknown command *EN*", "ja": "unknown command *EN*",
"zh": "unknown command *EN*" "zh": "unknown command *EN*"
}, },
"mtxcli.unset.help": { "mtxchat.unset.help": {
"en": "/unset key", "en": "/unset key",
"en-tts": "unset key", "en-tts": "unset key",
"fr": "/unset clé", "fr": "/unset clé",
"ja": "/unset key *EN*", "ja": "/unset key *EN*",
"zh": "/unset key *EN*" "zh": "/unset key *EN*"
}, },
"mtxcli.wifi.connected": { "mtxchat.wifi.connected": {
"en": "WiFi connected", "en": "WiFi connected",
"en-tts": "WiFi connected", "en-tts": "WiFi connected",
"fr": "WiFi connecté", "fr": "WiFi connecté",
"ja": "WiFi connected *EN*", "ja": "WiFi connected *EN*",
"zh": "WiFi connected *EN*" "zh": "WiFi connected *EN*"
}, },
"mtxcli.wifi.warning": { "mtxchat.wifi.warning": {
"en": "WARNING: WiFi not connected", "en": "WARNING: WiFi not connected",
"en-tts": "WARNING: WiFi not connected", "en-tts": "WARNING: WiFi not connected",
"fr": "AVERTISSEMENT: WiFi pas connecté", "fr": "AVERTISSEMENT: WiFi pas connecté",