mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
add locale to front-end; update menus to suppress 🔇characters automatically
This commit is contained in:
parent
8a3c8c3908
commit
86e113b678
4 changed files with 18 additions and 3 deletions
|
|
@ -263,7 +263,7 @@ impl Gam {
|
|||
).map(|_| ())
|
||||
}
|
||||
/// requests a context switch to a new app. Doesn't have to be obeyed, depending
|
||||
/// upon the GAM's policy. Only the main menu can switch apps, hence the token.
|
||||
/// upon the GAM's policy. Only the certain sources can switch apps, hence the token.
|
||||
pub fn switch_to_app(&self, app_name: &str, token: [u32; 4]) -> Result<(), xous::Error> {
|
||||
let switchapp = SwitchToApp {
|
||||
token,
|
||||
|
|
@ -277,7 +277,9 @@ impl Gam {
|
|||
let buf = Buffer::into_buf(menu_name).or(Err(xous::Error::InternalError))?;
|
||||
buf.send(self.conn, Opcode::RaiseMenu.to_u32().unwrap()).or(Err(xous::Error::InternalError)).map(|_|())
|
||||
}
|
||||
|
||||
pub fn raise_modal(&self, modal_name: &str) -> Result<(), xous::Error> {
|
||||
self.raise_menu(modal_name)
|
||||
}
|
||||
/// this is a one-way door, once you've set it, you can't unset it.
|
||||
pub fn set_devboot(&self, enable: bool) -> Result<(), xous::Error> {
|
||||
let ena =
|
||||
|
|
@ -397,6 +399,9 @@ impl Menu {
|
|||
}
|
||||
// if successful, returns None, otherwise, the menu item
|
||||
pub fn add_item(&mut self, new_item: MenuItem) -> Option<MenuItem> {
|
||||
if new_item.name.as_str().unwrap() == "🔇" { // suppress the addition of menu items that are not applicable for a given locale
|
||||
return None;
|
||||
}
|
||||
// first, do the insertion.
|
||||
// add the menu item to the first free slot
|
||||
// any modifications to the menu structure should guarantee that the list is compacted
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ log = "0.4"
|
|||
log-server = {path = "../log-server"}
|
||||
ticktimer-server = {path = "../ticktimer-server"}
|
||||
xous = {path = "../../xous-rs"}
|
||||
locales = {path = "../../locales"}
|
||||
xous-ipc = {path = "../../xous-ipc"}
|
||||
xous-names = {path = "../xous-names"}
|
||||
|
||||
|
|
|
|||
7
services/ime-frontend/locales/i18n.json
Normal file
7
services/ime-frontend/locales/i18n.json
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"input.greeting": {
|
||||
"en": "Ready for input...",
|
||||
"zh": "等待输入...",
|
||||
"en-audio": "Ready for input"
|
||||
}
|
||||
}
|
||||
|
|
@ -19,6 +19,8 @@ use xous::{CID, msg_scalar_unpack};
|
|||
|
||||
use core::fmt::Write;
|
||||
|
||||
use locales::t;
|
||||
|
||||
/// max number of prediction options to track/render
|
||||
const MAX_PREDICTION_OPTIONS: usize = 4;
|
||||
pub(crate) const EMOJI_MENU_NAME: &'static str = "emoji menu";
|
||||
|
|
@ -550,7 +552,7 @@ impl InputTracker {
|
|||
empty_tv.draw_border = false;
|
||||
empty_tv.border_width = 1;
|
||||
empty_tv.clear_area = true;
|
||||
write!(empty_tv.text, "Ready for input...").expect("couldn't set up empty TextView");
|
||||
write!(empty_tv.text, "{}", t!("input.greeting", xous::LANG)).expect("couldn't set up empty TextView");
|
||||
if debug_canvas { info!("pc canvas {:?}", pc) }
|
||||
self.gam.post_textview(&mut empty_tv).expect("can't draw prediction TextView");
|
||||
} else if update_predictor || force_redraw {
|
||||
|
|
|
|||
Loading…
Reference in a new issue