mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-13 10:08:08 +00:00
WIP: core part
This commit is contained in:
parent
db8e019711
commit
a476530b4e
@ -292,7 +292,7 @@ extern "C" fn verify(data: Obj) -> Obj {
|
|||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
pub static mp_module_trezortranslate: Module = obj_module! {
|
pub static mp_module_trezortranslate: Module = obj_module! {
|
||||||
/// from trezortranslate_keys import TR # noqa: F401
|
/// from trezortranslate_keys import TR as TR # noqa: F401
|
||||||
/// """Translation object with attributes."""
|
/// """Translation object with attributes."""
|
||||||
Qstr::MP_QSTR_TR => TR_OBJ.as_obj(),
|
Qstr::MP_QSTR_TR => TR_OBJ.as_obj(),
|
||||||
|
|
||||||
|
@ -1640,18 +1640,8 @@ extern "C" fn new_confirm_firmware_update(
|
|||||||
.vertically_centered();
|
.vertically_centered();
|
||||||
|
|
||||||
let obj = LayoutObj::new(
|
let obj = LayoutObj::new(
|
||||||
Confirm::new(
|
Confirm::new(theme::BG, title, message, None, TR::buttons__install, false)
|
||||||
theme::BG,
|
.with_info_screen(TR::firmware_update__title_fingerprint, fingerprint),
|
||||||
title,
|
|
||||||
message,
|
|
||||||
None,
|
|
||||||
TR::buttons__install,
|
|
||||||
false,
|
|
||||||
)
|
|
||||||
.with_info_screen(
|
|
||||||
TR::firmware_update__title_fingerprint,
|
|
||||||
fingerprint,
|
|
||||||
),
|
|
||||||
)?;
|
)?;
|
||||||
Ok(obj.into())
|
Ok(obj.into())
|
||||||
};
|
};
|
||||||
|
@ -1,11 +1,15 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
error::Error, micropython::buffer::StrBuffer, time::Instant, translations::TR, ui::{
|
error::Error,
|
||||||
|
micropython::buffer::StrBuffer,
|
||||||
|
time::Instant,
|
||||||
|
translations::TR,
|
||||||
|
ui::{
|
||||||
component::{paginated::PageMsg, Component, ComponentExt, Event, EventCtx, Pad, Paginate},
|
component::{paginated::PageMsg, Component, ComponentExt, Event, EventCtx, Pad, Paginate},
|
||||||
constant,
|
constant,
|
||||||
display::{self, Color},
|
display::{self, Color},
|
||||||
geometry::{Insets, Rect},
|
geometry::{Insets, Rect},
|
||||||
util::animation_disabled,
|
util::animation_disabled,
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
from typing import *
|
from typing import *
|
||||||
from trezortranslate_keys import TR # noqa: F401
|
from trezortranslate_keys import TR as TR # noqa: F401
|
||||||
|
|
||||||
"""Translation object with attributes."""
|
"""Translation object with attributes."""
|
||||||
MAX_HEADER_LEN: int
|
MAX_HEADER_LEN: int
|
||||||
"""Maximum length of the translations header."""
|
"""Maximum length of the translations header."""
|
||||||
|
@ -10,7 +10,7 @@ welcome_screen_start_ms = utime.ticks_ms()
|
|||||||
|
|
||||||
import storage
|
import storage
|
||||||
import storage.device
|
import storage.device
|
||||||
from trezor import config, log, loop, ui, utils, wire
|
from trezor import config, log, loop, ui, utils, wire, translations
|
||||||
from trezor.pin import (
|
from trezor.pin import (
|
||||||
allow_all_loader_messages,
|
allow_all_loader_messages,
|
||||||
ignore_nonpin_loader_messages,
|
ignore_nonpin_loader_messages,
|
||||||
@ -69,6 +69,7 @@ async def bootscreen() -> None:
|
|||||||
ignore_nonpin_loader_messages()
|
ignore_nonpin_loader_messages()
|
||||||
|
|
||||||
config.init(show_pin_timeout)
|
config.init(show_pin_timeout)
|
||||||
|
translations.init()
|
||||||
|
|
||||||
if __debug__ and not utils.EMULATOR:
|
if __debug__ and not utils.EMULATOR:
|
||||||
config.wipe()
|
config.wipe()
|
||||||
|
@ -1,2 +1,6 @@
|
|||||||
import trezorconfig as config # noqa: F401
|
import trezorconfig as config # noqa: F401
|
||||||
import trezorio as io # noqa: F401
|
import trezorio as io # noqa: F401
|
||||||
|
|
||||||
|
import trezortranslate as translations # noqa: F401
|
||||||
|
|
||||||
|
TR = translations.TR
|
||||||
|
@ -1,29 +0,0 @@
|
|||||||
from trezor import config
|
|
||||||
|
|
||||||
DEFAULT_LANGUAGE = "en-US"
|
|
||||||
|
|
||||||
|
|
||||||
def get_language() -> str:
|
|
||||||
from trezortranslate import language_name
|
|
||||||
|
|
||||||
translation_lang = language_name()
|
|
||||||
if translation_lang:
|
|
||||||
return translation_lang
|
|
||||||
return DEFAULT_LANGUAGE
|
|
||||||
|
|
||||||
|
|
||||||
def write(data: bytes | bytearray, offset: int) -> None:
|
|
||||||
from trezor import wire
|
|
||||||
|
|
||||||
if offset + len(data) > data_max_size():
|
|
||||||
raise wire.DataError("Language data too long")
|
|
||||||
|
|
||||||
config.translations_set(data, offset)
|
|
||||||
|
|
||||||
|
|
||||||
def wipe() -> None:
|
|
||||||
config.translations_wipe()
|
|
||||||
|
|
||||||
|
|
||||||
def data_max_size() -> int:
|
|
||||||
return config.translations_max_bytesize()
|
|
@ -7,7 +7,7 @@ from typing import TYPE_CHECKING, Dict
|
|||||||
HERE = Path(__file__).parent
|
HERE = Path(__file__).parent
|
||||||
CORE = HERE.parent.parent
|
CORE = HERE.parent.parent
|
||||||
|
|
||||||
DIR = CORE / "embed" / "rust" / "src" / "ui" / "translations"
|
DIR = CORE / "translations"
|
||||||
|
|
||||||
MISSING_VALUE = "TODO:missing"
|
MISSING_VALUE = "TODO:missing"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user