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 web::get_login_type(&self.server) {
let user = self.get_default(USER_KEY, USER_KEY);
if user.len() == 0 {
self.modals
.show_notification(t!("mtxcli.please.set.user", locales::LANG), None)
.expect("notification failed");
}
if user.len() == 0 {}
let password = self.get_default(PASSWORD_KEY, EMPTY);
if password.len() == 0 {
} else {
@ -323,10 +319,8 @@ impl MtxChat {
}
}
if self.logged_in {
// self.scalar_async_msg(LOGGED_IN_ID);
log::info!("logged_in");
} else {
// self.scalar_async_msg(LOGIN_FAILED_ID);
log::info!("login failed");
}
self.logged_in
@ -334,18 +328,18 @@ impl MtxChat {
pub fn login_modal(&mut self) {
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) {
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) {
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) {
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() {
let mut user = "@".to_string();

View file

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

View file

@ -1,222 +1,216 @@
{
"mtxcli.clock.warning": {
"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*"
},
"mtxcli.filter.failed": {
"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*"
},
"mtxcli.get.help": {
"mtxchat.get.help": {
"en": "/get key",
"en-tts": "get key",
"fr": "/get clé",
"ja": "/get key *EN*",
"zh": "/get key *EN*"
},
"mtxcli.greeting": {
"en": "Welcome to the MTXCLI demo. Type /help for available commands",
"en-tts": "Welcome to the simple MTXCLI demo. Type /help for available commands",
"fr": "Bienvenue à la démo simple de MTXCLI. Tapez /help pour les commandes disponibles",
"ja": "シンプルなMTXCLIデモへようこそ",
"zh": "简单的 mtxcli 演示活动"
"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": "简单的 mtxchat 演示活动"
},
"mtxcli.heap.help": {
"mtxchat.heap.help": {
"en": "/heap",
"en-tts": "heap",
"fr": "/heap",
"ja": "/heap",
"zh": "/heap"
},
"mtxcli.help.help": {
"mtxchat.help.help": {
"en": "/help [cmd]",
"en-tts": "help [cmd]",
"fr": "/help [cmd]",
"ja": "/help [cmd] *EN*",
"zh": "/help [cmd] *EN*"
},
"mtxcli.help.overview": {
"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*"
},
"mtxcli.initialized": {
"en": "MTXCLI ready",
"en-tts": "MTXCLI ready",
"fr": "MTXCLI prêt",
"ja": "MTXCLI ready *EN*",
"zh": "MTXCLI ready *EN*"
"mtxchat.initialized": {
"en": "MTXCHAT ready",
"en-tts": "MTXCHAT ready",
"fr": "MTXCHAT prêt",
"ja": "MTXCHAT ready *EN*",
"zh": "MTXCHAT ready *EN*"
},
"mtxcli.logged.in": {
"mtxchat.logged.in": {
"en": "logged in",
"en-tts": "logged in",
"fr": "connecté",
"ja": "logged in *EN*",
"zh": "logged in *EN*"
},
"mtxcli.logged.out": {
"mtxchat.logged.out": {
"en": "logged out",
"en-tts": "logged out",
"fr": "déconnecté",
"ja": "logged out *EN*",
"zh": "logged out *EN*"
},
"mtxcli.logging.in": {
"mtxchat.logging.in": {
"en": "logging in...",
"en-tts": "logging in",
"fr": "connexion...",
"ja": "logging in... *EN*",
"zh": "logging in... *EN*"
},
"mtxcli.login.failed": {
"mtxchat.login.failed": {
"en": "authentication failed",
"en-tts": "authentication failed",
"fr": "échec de l'authentification",
"ja": "authentication failed *EN*",
"zh": "authentication failed *EN*"
},
"mtxcli.login.help": {
"mtxchat.login.help": {
"en": "/login",
"en-tts": "login",
"fr": "/login (connexion)",
"ja": "/login *EN*",
"zh": "/login *EN*"
},
"mtxcli.logout.help": {
"mtxchat.logout.help": {
"en": "/logout",
"en-tts": "logout",
"fr": "/logout (déconnexion)",
"ja": "/logout *EN*",
"zh": "/logout *EN*"
},
"mtxcli.migration.completed": {
"mtxchat.migration.completed": {
"en": "migration completed",
"en-tts": "migration completed",
"fr": "migration terminée",
"ja": "migration completed *EN*",
"zh": "migration completed *EN*"
},
"mtxcli.migrations.complete": {
"mtxchat.migrations.complete": {
"en": "migrations complete",
"en-tts": "migrations complete",
"fr": "tous les migrations terminées",
"ja": "migrations complete *EN*",
"zh": "migrations complete *EN*"
},
"mtxcli.not.connected": {
"mtxchat.not.connected": {
"en": "not connected",
"en-tts": "not conntected",
"fr": "déconnecté",
"ja": "not connected *EN*",
"zh": "not connected *EN*"
},
"mtxcli.pddb.warning": {
"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*"
},
"mtxcli.please.login": {
"en": "please /login",
"en-tts": "please /login",
"fr": "Veuillez /login",
"ja": "please /login *EN*",
"zh": "please /login *EN*"
"mtxchat.login.title": {
"en": "Matrix /login",
"en-tts": "Matrix /login"
},
"mtxcli.please.set.password": {
"en": "please /set password my-password",
"en-tts": "please /set password my-password",
"fr": "Veuillez /set password mot-de-passe",
"ja": "please /set password my-password *EN*",
"zh": "please /set password my-password *EN*"
"mtxchat.password": {
"en": "password",
"en-tts": "password",
"fr": "de-passe",
"ja": "password *EN*",
"zh": "password *EN*"
},
"mtxcli.please.set.room": {
"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*"
},
"mtxcli.please.set.server": {
"en": "please /set server https://matrix.org",
"en-tts": "please /set server https://matrix.org",
"fr": "Veuillez /set server https://matrix.org",
"ja": "please /set server https://matrix.org *EN*",
"zh": "please /set server https://matrix.org *EN*"
"mtxchat.server": {
"en": "server",
"en-tts": "server"
},
"mtxcli.please.set.user": {
"en": "please /set user @USER:matrix.org",
"en-tts": "please /set user @USER:matrix.org",
"fr": "Veuillez /set user @UTILISATEUR:matrix.org",
"ja": "please /set user @USER:matrix.org *EN*",
"zh": "please /set user @USER:matrix.org *EN*"
"mtxchat.username": {
"en": "username",
"en-tts": "username",
"fr": "utilisateur",
"ja": "username *EN*",
"zh": "username *EN*"
},
"mtxcli.roomid.failed": {
"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*"
},
"mtxcli.running.migrations": {
"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*"
},
"mtxcli.send.failed": {
"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*"
},
"mtxcli.set.help": {
"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*"
},
"mtxcli.status.help": {
"mtxchat.status.help": {
"en": "/status",
"en-tts": "status",
"fr": "/status (statut)",
"ja": "/status *EN*",
"zh": "/status *EN*"
},
"mtxcli.unknown.help": {
"mtxchat.unknown.help": {
"en": "unknown command",
"en-tts": "unknown command",
"fr": "commande inconnue",
"ja": "unknown command *EN*",
"zh": "unknown command *EN*"
},
"mtxcli.unset.help": {
"mtxchat.unset.help": {
"en": "/unset key",
"en-tts": "unset key",
"fr": "/unset clé",
"ja": "/unset key *EN*",
"zh": "/unset key *EN*"
},
"mtxcli.wifi.connected": {
"mtxchat.wifi.connected": {
"en": "WiFi connected",
"en-tts": "WiFi connected",
"fr": "WiFi connecté",
"ja": "WiFi connected *EN*",
"zh": "WiFi connected *EN*"
},
"mtxcli.wifi.warning": {
"mtxchat.wifi.warning": {
"en": "WARNING: WiFi not connected",
"en-tts": "WARNING: WiFi not connected",
"fr": "AVERTISSEMENT: WiFi pas connecté",