Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve translations #6 #44

Merged
merged 15 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,123 changes: 1,259 additions & 864 deletions core/resources/i18n/i18n.json

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions core/src/modules/account_manager/balance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,21 @@ impl<'context> BalancePane<'context> {
}

if balance.pending != 0 {
ui.label(format!(
"Pending: {}",
sompi_to_kaspa_string_with_suffix(
ui.label(i18n_args(
"Pending: {amount}",
&[("amount", &sompi_to_kaspa_string_with_suffix(
balance.pending,
network_type
)
))]
));
}
if balance.outgoing != 0 {
ui.label(format!(
"Sending: {}",
sompi_to_kaspa_string_with_suffix(
ui.label(i18n_args(
"Sending: {amount}",
&[("amount", &sompi_to_kaspa_string_with_suffix(
balance.outgoing,
network_type
)
))]
));
}

Expand Down
6 changes: 3 additions & 3 deletions core/src/modules/account_manager/menus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl WalletMenu {
let wallet_name = if let Some(wallet_descriptor) = core.wallet_descriptor.as_ref() {
wallet_descriptor.title.as_deref().unwrap_or(wallet_descriptor.filename.as_str()).to_string()
} else {
ui.label("Missing wallet descriptor");
ui.label(i18n("Missing wallet descriptor"));
return;
};

Expand All @@ -41,7 +41,7 @@ impl WalletMenu {
let wallet_filename = if let Some(wallet_descriptor) = core.wallet_descriptor.as_ref() {
wallet_descriptor.filename.clone()
} else {
ui.label("Missing wallet descriptor");
ui.label(i18n("Missing wallet descriptor"));
return;
};

Expand Down Expand Up @@ -241,7 +241,7 @@ impl ToolsMenu {
}
pub fn render(&mut self, core: &mut Core, ui : &mut Ui, _account_manager : &mut AccountManager, _rc : &RenderContext, max_height: f32) {

PopupPanel::new(PopupPanel::id(ui,"tools_popup"),|ui|{ ui.add(Label::new(i18n("Tools ⏷")).sense(Sense::click())) }, |ui, _| {
PopupPanel::new(PopupPanel::id(ui,"tools_popup"),|ui|{ ui.add(Label::new(format!("{} ⏷", i18n("Tools"))).sense(Sense::click())) }, |ui, _| {

egui::ScrollArea::vertical()
.id_source("tools_popup_scroll")
Expand Down
2 changes: 1 addition & 1 deletion core/src/modules/account_manager/overview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl<'manager> Overview<'manager> {
ui.vertical_centered(|ui|{

ui.add_space(16.);
ui.label(RichText::new("An error has occurred while submitting transaction:"));
ui.label(RichText::new(i18n("An error has occurred while submitting transaction:")));
ui.add_space(16.);
ui.separator();
ui.add_space(8.);
Expand Down
2 changes: 1 addition & 1 deletion core/src/modules/block_dag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ impl ModuleT for BlockDag {
ui.heading(i18n("Block DAG"));

ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
PopupPanel::new(PopupPanel::id(ui,"block_dag_settings"),|ui|{ ui.add(Label::new("Settings ⏷").sense(Sense::click())) }, |ui, _| {
PopupPanel::new(PopupPanel::id(ui,"block_dag_settings"),|ui|{ ui.add(Label::new(format!("{} ⏷", i18n("Settings"))).sense(Sense::click())) }, |ui, _| {

CollapsingHeader::new(i18n("Dimensions"))
.open(Some(true))
Expand Down
21 changes: 13 additions & 8 deletions core/src/modules/scanner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ impl ModuleT for Scanner {
let back = Rc::new(RefCell::new(false));

Panel::new(self)
.with_caption("Scanner")
.with_caption(i18n("Scanner"))
.with_back(|_this| {
*back.borrow_mut() = true;
})
Expand Down Expand Up @@ -295,7 +295,7 @@ impl ModuleT for Scanner {
).await?;

} else {
*status.lock().unwrap() = Status::error("Account not found");
*status.lock().unwrap() = Status::error(i18n("Account not found"));
}

Ok(())
Expand Down Expand Up @@ -328,10 +328,13 @@ impl ModuleT for Scanner {
ui.label(message);
}
Status::Processing { index, utxo_count, balance } => {
ui.label(format!("Scanning address derivation {}...", index.separated_string()));
ui.label(format!("Located {} UTXOs", utxo_count.separated_string()));
//ui.label(format!("Scanning address derivation {}...", index.separated_string()));
//ui.label(format!("Located {} UTXOs", utxo_count.separated_string()));
ui.label(i18n_args("Scanning address derivation {index}...", &[("index", &index.separated_string())]));
ui.label(i18n_args("Located {utxo_count} UTXOs", &[("utxo_count", &utxo_count.separated_string())]));

ui.add_space(16.);
ui.label(RichText::new("BALANCE").size(12.).raised());
ui.label(RichText::new(i18n("BALANCE")).size(12.).raised());
ui.label(
s2kws_layout_job(core.balance_padding(), *balance, &network_type, theme_color().balance_color,FontId::proportional(28.))
);
Expand Down Expand Up @@ -368,10 +371,12 @@ impl ModuleT for Scanner {
.with_body(|this,ui| {

if let Status::Processing { index,utxo_count, balance } = &*this.context.status.lock().unwrap() {
ui.label(format!("Total addresses scanned: {}", index.separated_string()));
ui.label(format!("Located {} UTXOs", utxo_count.separated_string()));
//ui.label(format!("Total addresses scanned: {}", index.separated_string()));
//ui.label(format!("Located {} UTXOs", utxo_count.separated_string()));
ui.label(i18n_args("Total addresses scanned: {index}", &[("index", &index.separated_string())]));
ui.label(i18n_args("Located {utxo_count} UTXOs", &[("utxo_count", &utxo_count.separated_string())]));
ui.add_space(16.);
ui.label(RichText::new("BALANCE").size(12.).raised());
ui.label(RichText::new(i18n("BALANCE")).size(12.).raised());
ui.label(
s2kws_layout_job(balance_padding, *balance, &network_type, theme_color().balance_color,FontId::proportional(28.))
);
Expand Down
2 changes: 1 addition & 1 deletion core/src/modules/wallet_create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ impl ModuleT for WalletCreate {

})
.with_footer(|this,ui| {
let text = if this.context.account_name.is_not_empty() { i18n("Continue") } else { "Skip" };
let text = if this.context.account_name.is_not_empty() { i18n("Continue") } else { i18n("Skip") };
if ui.large_button(i18n(text)).clicked() {
this.state = State::PhishingHint;
this.focus.next(Focus::PhishingHint);
Expand Down
2 changes: 1 addition & 1 deletion core/src/modules/wallet_secret.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ impl ModuleT for WalletSecret {
// let mut back = false;

Panel::new(self)
.with_caption("Change Wallet Secret")
.with_caption(i18n("Change Wallet Secret"))
.with_back(|_this| {
*back.borrow_mut() = true;
})
Expand Down
7 changes: 4 additions & 3 deletions core/src/modules/welcome.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ impl Welcome {
if ui.medium_button(format!("{} {}", egui_phosphor::light::CHECK, i18n("Apply"))).clicked() {
let mut settings = self.settings.clone();
settings.initialized = true;
settings.store_sync().expect("Unable to store settings");
let message = i18n("Unable to store settings");
settings.store_sync().expect(message);
self.runtime.kaspa_service().update_services(&self.settings.node, None);
core.settings = settings.clone();
core.get_mut::<modules::Settings>().load(settings);
Expand Down Expand Up @@ -231,8 +232,8 @@ impl Welcome {
if proceed {
let mut settings = self.settings.clone();
settings.initialized = true;

settings.store_sync().expect("Unable to store settings");
let message = i18n("Unable to store settings");
settings.store_sync().expect(message);
core.settings = settings.clone();
self.runtime.kaspa_service().update_services(&settings.node, None);

Expand Down