Add missing localized strings and export strings for translation

This commit is contained in:
2025-09-04 22:22:27 -04:00
parent c765b031e9
commit 97b6755504
6 changed files with 147 additions and 9 deletions

View File

@@ -2,7 +2,7 @@ use std::mem;
use egui::{Layout, ScrollArea};
use nostrdb::Ndb;
use notedeck::{Images, JobPool, JobsCache, Localization};
use notedeck::{tr, Images, JobPool, JobsCache, Localization};
use notedeck_ui::{
colors,
nip51_set::{Nip51SetUiCache, Nip51SetWidget, Nip51SetWidgetAction, Nip51SetWidgetFlags},
@@ -107,7 +107,7 @@ impl<'a> FollowPackOnboardingView<'a> {
ui.with_layout(Layout::top_down(egui::Align::Center), |ui| {
ui.add_space(4.0);
if ui.add(styled_button("Done", colors::PINK)).clicked() {
if ui.add(styled_button(tr!(self.loc, "Done", "Button to indicate that the user is done going through the onboarding process.").as_str(), colors::PINK)).clicked() {
action = Some(OnboardingResponse::FollowPacks(
FollowPacksResponse::UserSelectedPacks(mem::take(self.ui_state)),
));

View File

@@ -163,7 +163,10 @@ impl<'a, 'd> ProfileView<'a, 'd> {
.border(ProfilePic::border_stroke(ui)),
);
if ui.add(copy_key_widget(&pfp_rect)).clicked() {
if ui
.add(copy_key_widget(&pfp_rect, self.note_context.i18n))
.clicked()
{
let to_copy = if let Some(bech) = self.pubkey.npub() {
bech
} else {
@@ -297,7 +300,10 @@ fn handle_lud16(ui: &mut egui::Ui, lud16: &str) {
.on_hover_text(lud16);
}
fn copy_key_widget(pfp_rect: &egui::Rect) -> impl egui::Widget + '_ {
fn copy_key_widget<'a>(
pfp_rect: &'a egui::Rect,
i18n: &'a mut Localization,
) -> impl egui::Widget + 'a {
|ui: &mut egui::Ui| -> egui::Response {
let painter = ui.painter();
#[allow(deprecated)]
@@ -311,7 +317,11 @@ fn copy_key_widget(pfp_rect: &egui::Rect) -> impl egui::Widget + '_ {
ui.id().with("custom_painter"),
Sense::click(),
)
.on_hover_text("Copy npub to clipboard");
.on_hover_text(tr!(
i18n,
"Copy npub to clipboard",
"Tooltip text for copying npub to clipboard"
));
let copy_key_rounding = CornerRadius::same(100);
let fill_color = if resp.hovered() {

View File

@@ -120,7 +120,7 @@ impl<'a> DesktopSidePanel<'a> {
.color(ui.visuals().noninteractive().fg_stroke.color),
));
ui.add_space(8.0);
let add_deck_resp = ui.add(add_deck_button());
let add_deck_resp = ui.add(add_deck_button(self.i18n));
let decks_inner = ScrollArea::vertical()
.max_height(ui.available_height() - (3.0 * (ICON_WIDTH + 12.0)))
@@ -383,7 +383,7 @@ pub fn search_button() -> impl Widget {
// TODO: convert to responsive button when expanded side panel impl is finished
fn add_deck_button() -> impl Widget {
fn add_deck_button<'a>(i18n: &'a mut Localization) -> impl Widget + 'a {
|ui: &mut egui::Ui| -> egui::Response {
let img_size = 40.0;
@@ -403,7 +403,11 @@ fn add_deck_button() -> impl Widget {
helper
.take_animation_response()
.on_hover_cursor(CursorIcon::PointingHand)
.on_hover_text("Add new deck")
.on_hover_text(tr!(
i18n,
"Add new deck",
"Tooltip text for adding a new deck button"
))
}
}

View File

@@ -572,7 +572,7 @@ fn repost_description(
tr_plural!(
loc,
"{name} and {count} other reposted a note you were tagged in",
"{name} and {ocunt} others reposted a note you were tagged in",
"{name} and {count} others reposted a note you were tagged in",
"describing the amount of reposts a note you were tagged in received",
count,
name = first_name