1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-07-19 13:08:14 +00:00

WIP - move translations to a top-level module

This commit is contained in:
matejcik 2024-01-15 14:08:47 +01:00
parent 9b86d9a829
commit 2ac3da18f5
38 changed files with 13 additions and 5 deletions

View File

@ -28,6 +28,8 @@ mod storage;
mod time;
#[cfg(feature = "ui_debug")]
mod trace;
#[cfg(feature = "translations")]
pub mod translations;
#[cfg(feature = "ui")]
#[macro_use]

View File

@ -1,7 +1,7 @@
use crate::{
error::Error,
micropython::{
buffer::get_buffer,
buffer::{get_buffer, StrBuffer},
ffi,
gc::Gc,
map::Map,
@ -13,7 +13,13 @@ use crate::{
},
};
use super::TranslatedString;
use super::translated_string::TranslatedString;
pub fn tr(item: TranslatedString) -> StrBuffer {
// SAFETY:
let stored_translations = item.translate(unsafe { super::flash::get() });
StrBuffer::alloc(stored_translations)
}
#[repr(C)]
pub struct TrObj {

View File

@ -4,7 +4,9 @@ mod generated;
mod micropython;
mod translated_string;
pub use translated_string::TranslatedString;
pub use translated_string::TranslatedString as TR;
#[cfg(feature = "micropython")]
pub use micropython::tr;
use crate::{error::Error, io::InputStream};
use core::{ptr::null, str};

View File

@ -9,8 +9,6 @@ pub mod event;
pub mod geometry;
pub mod lerp;
pub mod screens;
#[cfg(feature = "translations")]
pub mod translations;
#[macro_use]
pub mod util;