Skip to content

Commit

Permalink
Improve translations #5 (#42)
Browse files Browse the repository at this point in the history
* Updated German translation

* Added new but currently untranslated strings

* Updated source strings

* Remove unused strings from i18n.json

* Add/restore strings to i18n.json

* Use translation of more strings

* Fix typo

* Cleanup obsolete and add new strings to translate

* Add more strings from send dialog to i18n.json

* Updated German translation

* Add more strings from export.rs

* Add more strings from import.rs

* Add more strings from overview.rs

* Add more strings from other overview.rs

* Updated translations

* Updated German translations

* Updated English base strings

* Updated de, fr, id and pt_br

* Fixed spelling of low|med|high kas
  • Loading branch information
HLXEasy authored Sep 21, 2024
1 parent 41a801b commit 170d56a
Show file tree
Hide file tree
Showing 11 changed files with 3,901 additions and 1,409 deletions.
5,211 changes: 3,851 additions & 1,360 deletions core/resources/i18n/i18n.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions core/src/modules/account_manager/details.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ impl Details {
let mut address_kind : Option<NewAddressKind> = None;

ui.horizontal(|ui|{
if ui.medium_button("Generate New Receive Address").clicked() {
if ui.medium_button(i18n("Generate New Receive Address")).clicked() {
address_kind = Some(NewAddressKind::Receive);
}
if ui.medium_button("Generate New Change Address").clicked() {
if ui.medium_button(i18n("Generate New Change Address")).clicked() {
address_kind = Some(NewAddressKind::Change);
}
});
Expand Down
5 changes: 2 additions & 3 deletions core/src/modules/account_manager/estimator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ impl<'context> Estimator<'context> {
(false, GeneratorSummary::new(network_id),Some(RichText::new(error.to_string()).color(theme_color().error_color)))
}
EstimatorStatus::None => {
// ui.label(format!("{} {} {}", i18n("Please enter"), kaspa_suffix(&network_type), i18n("amount to send")));
let err = i18n_args("Please enter {suffix} amount to send", &[("suffix", kaspa_suffix(&network_type))]);
(false, GeneratorSummary::new(network_id),Some(RichText::new(err).color(theme_color().error_color)))
}
Expand All @@ -56,7 +55,7 @@ impl<'context> Estimator<'context> {
Focus::Amount,
|ui, text| {
ui.add_space(8.);
ui.label(RichText::new(format!("{} {} {}", i18n("Enter"), kaspa_suffix(&network_type), i18n("amount to send"))).size(12.).raised());
ui.label(RichText::new(i18n_args("Enter {suffix} amount to send", &[("suffix", kaspa_suffix(&network_type))])).size(12.).raised());
ui.add_sized(Overview::editor_size(ui), TextEdit::singleline(text)
.vertical_align(Align::Center))
},
Expand Down Expand Up @@ -103,7 +102,7 @@ impl<'context> Estimator<'context> {
// (false, GeneratorSummary::new(network_id))
// }
// EstimatorStatus::None => {
// ui.label(format!("{} {} {}", i18n("Please enter"), kaspa_suffix(&network_type), i18n("amount to send")));
// ui.label(i18n_args("Please enter {suffix} amount to send", &[("suffix", kaspa_suffix(&network_type))]));
// (false, GeneratorSummary::new(network_id))
// }
// };
Expand Down
6 changes: 3 additions & 3 deletions core/src/modules/account_manager/overview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,20 @@ impl<'manager> Overview<'manager> {

let mut layout = CenterLayoutBuilder::new();

layout = layout.add(Button::new(format!("{} Send", ARROW_CIRCLE_UP)).min_size(theme_style().medium_button_size()), |(this, _):&mut (&mut Overview<'_>, &mut Core)| {
layout = layout.add(Button::new(i18n_args("{arrowCircleUpIcon} Send", &[("arrowCircleUpIcon", ARROW_CIRCLE_UP)])).min_size(theme_style().medium_button_size()), |(this, _):&mut (&mut Overview<'_>, &mut Core)| {
this.context.action = Action::Estimating;
this.context.transaction_kind = Some(TransactionKind::Send);
this.context.focus.next(Focus::Address);
});

if core.account_collection().as_ref().map(|collection|collection.len()).unwrap_or(0) > 1 {
layout = layout.add(Button::new(format!("{} Transfer", ARROWS_DOWN_UP)).min_size(theme_style().medium_button_size()), |(this,_)| {
layout = layout.add(Button::new(i18n_args("{arrowsDownUpIcon} Transfer", &[("arrowsDownUpIcon", ARROWS_DOWN_UP)])).min_size(theme_style().medium_button_size()), |(this,_)| {
this.context.action = Action::Estimating;
this.context.transaction_kind = Some(TransactionKind::Transfer);
this.context.focus.next(Focus::Amount);
});
}
layout = layout.add(Button::new(format!("{} Request", QR_CODE)).min_size(theme_style().medium_button_size()), |(_,core)| {
layout = layout.add(Button::new(i18n_args("{qrCodeIcon} Request", &[("qrCodeIcon", QR_CODE)])).min_size(theme_style().medium_button_size()), |(_,core)| {
core.get_mut::<modules::Request>().select(&rc.account);
core.select::<modules::Request>();

Expand Down
2 changes: 1 addition & 1 deletion core/src/modules/account_manager/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl<'context> Processor<'context> {
ui.add_space(8.);
match self.context.transaction_kind.as_ref().unwrap() {
TransactionKind::Send => {
ui.label("Sending funds");
ui.label(i18n("Sending funds"));
ui.add_space(8.);
}
TransactionKind::Transfer => {
Expand Down
16 changes: 10 additions & 6 deletions core/src/modules/account_manager/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ impl<'context> Transfer<'context> {

if let Some(account) = default_account {
self.context.transfer_to_account = Some(account.clone());
ui.label(format!("Transferring funds to: {}", account.name_or_id()));
ui.label(format!("Destination balance: {}", sompi_to_kaspa_string_with_suffix(account.balance().map(|balance|balance.mature).unwrap_or(0), network_type)));
// ui.label(format!("Transferring funds to: {}", account.name_or_id()));
ui.label(i18n_args("Transferring funds to: {account}", &[("account", account.name_or_id())]));
// ui.label(format!("Destination balance: {}", sompi_to_kaspa_string_with_suffix(account.balance().map(|balance|balance.mature).unwrap_or(0), network_type)));
ui.label(i18n_args("Destination balance: {balance}", &[("balance", sompi_to_kaspa_string_with_suffix(account.balance().map(|balance|balance.mature).unwrap_or(0), network_type))]));
} else {

if self.context.transfer_to_account.as_ref().map(|account|account.id() == rc.account.id()).unwrap_or_default() {
Expand All @@ -41,13 +43,15 @@ impl<'context> Transfer<'context> {
PopupPanel::new(PopupPanel::id(ui,"transfer_selector_popup"),|ui|{
let response = ui.vertical_centered(|ui| {
if let Some(account) = transfer_to_account {
let response = ui.add(Label::new(format!("Transferring funds to: {} ⏷", account.name_or_id())).sense(Sense::click()));
ui.label(format!("Destination balance: {}", sompi_to_kaspa_string_with_suffix(account.balance().map(|balance|balance.mature).unwrap_or(0), network_type)));
// let response = ui.add(Label::new(format!("Transferring funds to: {} ⏷", account.name_or_id())).sense(Sense::click()));
let response = ui.add(Label::new(i18n_args("Transferring funds to: {account}", &[("account", account.name_or_id())])).sense(Sense::click()));
// ui.label(format!("Destination balance: {}", sompi_to_kaspa_string_with_suffix(account.balance().map(|balance|balance.mature).unwrap_or(0), network_type)));
ui.label(i18n_args("Destination balance: {balance}", &[("balance", sompi_to_kaspa_string_with_suffix(account.balance().map(|balance|balance.mature).unwrap_or(0), network_type))]));
response
} else if self.context.send_amount_text.is_not_empty() {
ui.add(Label::new(RichText::new("Please select destination account ⏷").color(theme_color().warning_color)).sense(Sense::click()))
ui.add(Label::new(RichText::new(i18n("Please select destination account ⏷")).color(theme_color().warning_color)).sense(Sense::click()))
} else {
ui.add(Label::new(RichText::new("Please select destination account ⏷")).sense(Sense::click()))
ui.add(Label::new(RichText::new(i18n("Please select destination account ⏷"))).sense(Sense::click()))
}
});

Expand Down
8 changes: 4 additions & 4 deletions core/src/modules/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ pub enum ExportKind {
impl ExportKind {
pub fn info(&self) -> (&'static str,&'static str) {
match self {
Self::Mnemonic => ("Private Key Mnemonic","Private key mnemonic stored in this wallet"),
Self::Transportable => ("Transportable", "Encrypted hex encoded data easily importable into another instance of KaspaNG"),
Self::Mnemonic => (i18n("Private Key Mnemonic"),i18n("Private key mnemonic stored in this wallet")),
Self::Transportable => (i18n("Transportable"), i18n("Encrypted hex encoded data easily importable into another instance of Kaspa-NG")),
}
}
}
Expand Down Expand Up @@ -114,7 +114,7 @@ impl ModuleT for Export {
})
.with_header(|_ctx,ui| {
ui.add_space(64.);
ui.label("Please select export type");
ui.label(i18n("Please select export type"));
})
.with_body(|this,ui| {

Expand Down Expand Up @@ -190,7 +190,7 @@ impl ModuleT for Export {
let requires_bip39_passphrase = self.context.prv_key_data_info.as_ref().unwrap().requires_bip39_passphrase();

Panel::new(self)
.with_caption("Unlock Wallet")
.with_caption(i18n("Unlock Wallet"))
.with_back(|this| {
this.state = State::Select;
})
Expand Down
29 changes: 13 additions & 16 deletions core/src/modules/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ impl ModuleT for Import {
State::Words => {

Panel::new(self)
.with_caption("Mnemonic Import")
.with_caption(i18n("Mnemonic Import"))
.with_close_enabled(false, |_|{
})
.with_header(|this,ui| {
// ui.add_space(64.);
ui.label("Importing word N/N");
ui.label(i18n("Importing word N/N"));

ui.horizontal(|ui|{
// ui.vertical_centered_justified(|ui|{
Expand Down Expand Up @@ -115,9 +115,9 @@ impl ModuleT for Import {

}
State::Select => {
ui.heading("Select Wallet");
ui.heading(i18n("Select Wallet"));
ui.label(" ");
ui.label("Select a wallet to unlock");
ui.label(i18n("Select a wallet to unlock"));
ui.label(" ");
// ui.add_space(32.);

Expand All @@ -138,23 +138,20 @@ impl ModuleT for Import {
});
}
State::Unlock(message) => {
ui.heading("Unlock Wallet");
ui.heading(i18n("Unlock Wallet"));

egui::ScrollArea::vertical()
.id_source("unlock-wallet")
.show(ui, |ui| {
ui.label(" ");
ui.label(format!(
"Opening wallet: \"{}\"",
self.selected_wallet.as_ref().unwrap()
));
ui.label(i18n_args("Opening wallet: {wallet}", &[("wallet", self.selected_wallet.as_ref().unwrap())]));
ui.label(" ");

if let Some(message) = message {
ui.label(" ");

ui.label(
RichText::new("Error unlocking wallet")
RichText::new(i18n("Error unlocking wallet"))
.color(egui::Color32::from_rgb(255, 120, 120)),
);
ui.label(
Expand All @@ -165,18 +162,18 @@ impl ModuleT for Import {
ui.label(" ");
}

ui.label("Enter your password to unlock your wallet");
ui.label(i18n("Enter your password to unlock your wallet"));
ui.label(" ");

ui.add_sized(
size,
TextEdit::singleline(&mut self.wallet_secret)
.hint_text("Enter Password...")
.hint_text(i18n("Enter Password..."))
.password(true)
.vertical_align(Align::Center),
);

if ui.add_sized(size, egui::Button::new("Unlock")).clicked() {
if ui.add_sized(size, egui::Button::new(i18n("Unlock"))).clicked() {
let wallet_secret = Secret::new(
self.wallet_secret.as_bytes().to_vec()
);
Expand All @@ -198,18 +195,18 @@ impl ModuleT for Import {
ui.label(" ");

if ui
.add_sized(size, egui::Button::new("Select a different wallet"))
.add_sized(size, egui::Button::new(i18n("Select a different wallet")))
.clicked()
{
self.state = State::Select;
}
});
}
State::Unlocking => {
ui.heading("Unlocking");
ui.heading(i18n("Unlocking"));
// ui.separator();
ui.label(" ");
ui.label("Unlocking wallet, please wait...");
ui.label(i18n("Unlocking wallet, please wait..."));
ui.label(" ");
ui.add_space(64.);
ui.add(egui::Spinner::new().size(92.));
Expand Down
21 changes: 12 additions & 9 deletions core/src/modules/overview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,16 +349,15 @@ impl Overview {
// if ui.add(Label::new(format!("Kaspa NG v{}-{} + Rusty Kaspa v{}", env!("CARGO_PKG_VERSION"),crate::app::GIT_DESCRIBE, kaspa_wallet_core::version())).sense(Sense::click())).clicked() {
// core.select::<modules::Changelog>();
// }
ui.label(format!("Timestamp: {}", crate::app::BUILD_TIMESTAMP));
ui.label(format!("rustc {}-{} {} llvm {}",
// ui.label(format!("Timestamp: {}", crate::app::BUILD_TIMESTAMP));
ui.label(i18n_args("Timestamp: {timestamp}", &[("timestamp", crate::app::BUILD_TIMESTAMP)]));
ui.label(format!("rustc {}-{} {} llvm {}",
crate::app::RUSTC_SEMVER,
crate::app::RUSTC_COMMIT_HASH.chars().take(8).collect::<String>(),
crate::app::RUSTC_CHANNEL,
crate::app::RUSTC_LLVM_VERSION,
));
ui.label(format!("architecture {}",
crate::app::CARGO_TARGET_TRIPLE
));
ui.label(i18n_args("Architecture {arch}", &[("arch", crate::app::CARGO_TARGET_TRIPLE)]));
});

if let Some(system) = runtime().system() {
Expand Down Expand Up @@ -420,7 +419,8 @@ impl Overview {
CollapsingHeader::new(i18n("Statistics"))
.default_open(true)
.show(ui, |ui| {
ui.label(format!("Network Pressure: ~{}%", core.network_pressure.capacity()));
// ui.label(format!("Network Pressure: ~{}%", core.network_pressure.capacity()));
ui.label(i18n_args("Network Pressure: ~{number}%", &[("number", core.network_pressure.capacity().to_string())]));
});
}

Expand All @@ -438,9 +438,12 @@ impl Overview {
CollapsingHeader::new(i18n("Fee Market"))
.default_open(true)
.show(ui, |ui| {
ui.label(format!("Low: {} SOMPI/g; ~{}/tx", format_with_precision(low), low_kas));
ui.label(format!("Economic: {} SOMPI/g; ~{}/tx", format_with_precision(med),med_kas));
ui.label(format!("Priority: {} SOMPI/g; ~{}/tx", format_with_precision(high),high_kas));
// ui.label(format!("Low: {} SOMPI/g; ~{}/tx", format_with_precision(low), low_kas));
// ui.label(format!("Economic: {} SOMPI/g; ~{}/tx", format_with_precision(med),med_kas));
// ui.label(format!("Priority: {} SOMPI/g; ~{}/tx", format_with_precision(high),high_kas));
ui.label(i18n_args("Low: {low} SOMPI/g; ~{low_kas}/tx", &[("low", format_with_precision(low)), ("low_kas", low_kas)]));
ui.label(i18n_args("Economic: {med} SOMPI/g; ~{med_kas}/tx", &[("med", format_with_precision(med)), ("med_kas", med_kas)]));
ui.label(i18n_args("Priority: {high} SOMPI/g; ~{high_kas}/tx", &[("high", format_with_precision(high)), ("high_kas", high_kas)]));
});
}
}
Expand Down
6 changes: 3 additions & 3 deletions core/src/modules/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,14 @@ impl ModuleT for Request {
let close = Rc::new(RefCell::new(false));

Panel::new(self)
.with_caption("Payment Request")
.with_caption(i18n("Payment Request"))
.with_back_enabled(core.has_stack(), |_|{
*close.borrow_mut() = true;
})
.with_header(|this, ui| {
if let Some(account) = this.account.as_ref() {
ui.label("");
ui.label(format!("Payment request to account: {}",account.name_or_id()));
ui.label(i18n_args("Payment request to account: {account}", &[("account", account.name_or_id())]));
}
// ui.label(text);
})
Expand Down Expand Up @@ -197,7 +197,7 @@ impl ModuleT for Request {
},
Err(_err) => {
this.amount_sompi = None;
this.error = Some(i18n("Please enter a valid about of KAS").to_string());
this.error = Some(i18n("Please enter a valid amount of KAS").to_string());
},
}
}
Expand Down
2 changes: 0 additions & 2 deletions core/src/modules/wallet_create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,10 @@ impl WalletCreate {
#[allow(clippy::comparison_chain)]
if phrase.len() < needed {
ui.label("");
// ui.label(format!("{} {} {}", i18n("Please enter additional"), needed - phrase.len(), i18n("words")));
ui.label(i18n_args("Please enter additional {amount} words", &[("amount", (needed - phrase.len()).to_string())]));
ui.label("");
} else if phrase.len() > needed {
ui.label("");
// ui.colored_label(error_color(), format!("{} '{}' {}", i18n("Too many words in the"), phrase.len() - needed, i18n("word mnemonic")));
ui.colored_label(error_color(), i18n_args("Too many words ({words}) in the {amount} word mnemonic", &[
("words",phrase.len().to_string()),
("amount",(phrase.len() - needed).to_string())
Expand Down

0 comments on commit 170d56a

Please sign in to comment.