Internationalize user-facing strings and export them for translations
Changelog-Added: Internationalized user-facing strings and exported them for translations Signed-off-by: Terry Yiu <git@tyiu.xyz>
This commit is contained in:
@@ -6,7 +6,7 @@ use nostrdb::{Ndb, Transaction};
|
||||
use notedeck::{
|
||||
contacts::{contacts_filter, hybrid_contacts_filter},
|
||||
filter::{self, default_limit, default_remote_limit, HybridFilter},
|
||||
FilterError, FilterState, NoteCache, RootIdError, RootNoteIdBuf,
|
||||
tr, FilterError, FilterState, NoteCache, RootIdError, RootNoteIdBuf,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::hash::{Hash, Hasher};
|
||||
@@ -257,14 +257,47 @@ impl AlgoTimeline {
|
||||
impl Display for TimelineKind {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
TimelineKind::List(ListKind::Contact(_src)) => f.write_str("Home"),
|
||||
TimelineKind::Algo(AlgoTimeline::LastPerPubkey(_lk)) => f.write_str("Last Notes"),
|
||||
TimelineKind::Generic(_) => f.write_str("Timeline"),
|
||||
TimelineKind::Notifications(_) => f.write_str("Notifications"),
|
||||
TimelineKind::Profile(_) => f.write_str("Profile"),
|
||||
TimelineKind::Universe => f.write_str("Universe"),
|
||||
TimelineKind::Hashtag(_) => f.write_str("Hashtags"),
|
||||
TimelineKind::Search(_) => f.write_str("Search"),
|
||||
TimelineKind::List(ListKind::Contact(_src)) => write!(
|
||||
f,
|
||||
"{}",
|
||||
tr!("Home", "Timeline kind label for contact lists")
|
||||
),
|
||||
TimelineKind::Algo(AlgoTimeline::LastPerPubkey(_lk)) => write!(
|
||||
f,
|
||||
"{}",
|
||||
tr!(
|
||||
"Last Notes",
|
||||
"Timeline kind label for last notes per pubkey"
|
||||
)
|
||||
),
|
||||
TimelineKind::Generic(_) => {
|
||||
write!(f, "{}", tr!("Timeline", "Generic timeline kind label"))
|
||||
}
|
||||
TimelineKind::Notifications(_) => write!(
|
||||
f,
|
||||
"{}",
|
||||
tr!("Notifications", "Timeline kind label for notifications")
|
||||
),
|
||||
TimelineKind::Profile(_) => write!(
|
||||
f,
|
||||
"{}",
|
||||
tr!("Profile", "Timeline kind label for user profiles")
|
||||
),
|
||||
TimelineKind::Universe => write!(
|
||||
f,
|
||||
"{}",
|
||||
tr!("Universe", "Timeline kind label for universe feed")
|
||||
),
|
||||
TimelineKind::Hashtag(_) => write!(
|
||||
f,
|
||||
"{}",
|
||||
tr!("Hashtag", "Timeline kind label for hashtag feeds")
|
||||
),
|
||||
TimelineKind::Search(_) => write!(
|
||||
f,
|
||||
"{}",
|
||||
tr!("Search", "Timeline kind label for search results")
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -567,15 +600,26 @@ impl TimelineKind {
|
||||
ColumnTitle::formatted(format!("Search \"{}\"", query.search))
|
||||
}
|
||||
TimelineKind::List(list_kind) => match list_kind {
|
||||
ListKind::Contact(_pubkey_source) => ColumnTitle::simple("Contacts"),
|
||||
ListKind::Contact(_pubkey_source) => {
|
||||
ColumnTitle::formatted(tr!("Contacts", "Column title for contact lists"))
|
||||
}
|
||||
},
|
||||
TimelineKind::Algo(AlgoTimeline::LastPerPubkey(list_kind)) => match list_kind {
|
||||
ListKind::Contact(_pubkey_source) => ColumnTitle::simple("Contacts (last notes)"),
|
||||
ListKind::Contact(_pubkey_source) => ColumnTitle::formatted(tr!(
|
||||
"Contacts (last notes)",
|
||||
"Column title for last notes per contact"
|
||||
)),
|
||||
},
|
||||
TimelineKind::Notifications(_pubkey_source) => ColumnTitle::simple("Notifications"),
|
||||
TimelineKind::Notifications(_pubkey_source) => {
|
||||
ColumnTitle::formatted(tr!("Notifications", "Column title for notifications"))
|
||||
}
|
||||
TimelineKind::Profile(_pubkey_source) => ColumnTitle::needs_db(self),
|
||||
TimelineKind::Universe => ColumnTitle::simple("Universe"),
|
||||
TimelineKind::Generic(_) => ColumnTitle::simple("Custom"),
|
||||
TimelineKind::Universe => {
|
||||
ColumnTitle::formatted(tr!("Universe", "Column title for universe feed"))
|
||||
}
|
||||
TimelineKind::Generic(_) => {
|
||||
ColumnTitle::formatted(tr!("Custom", "Column title for custom timelines"))
|
||||
}
|
||||
TimelineKind::Hashtag(hashtag) => ColumnTitle::formatted(hashtag.join(" ").to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ use crate::{
|
||||
use notedeck::{
|
||||
contacts::hybrid_contacts_filter,
|
||||
filter::{self, HybridFilter},
|
||||
Accounts, CachedNote, ContactState, FilterError, FilterState, FilterStates, NoteCache, NoteRef,
|
||||
UnknownIds,
|
||||
tr, Accounts, CachedNote, ContactState, FilterError, FilterState, FilterStates, NoteCache,
|
||||
NoteRef, UnknownIds,
|
||||
};
|
||||
|
||||
use egui_virtual_list::VirtualList;
|
||||
@@ -64,10 +64,12 @@ pub enum ViewFilter {
|
||||
}
|
||||
|
||||
impl ViewFilter {
|
||||
pub fn name(&self) -> &'static str {
|
||||
pub fn name(&self) -> String {
|
||||
match self {
|
||||
ViewFilter::Notes => "Notes",
|
||||
ViewFilter::NotesAndReplies => "Notes & Replies",
|
||||
ViewFilter::Notes => tr!("Notes", "Filter label for notes only view"),
|
||||
ViewFilter::NotesAndReplies => {
|
||||
tr!("Notes & Replies", "Filter label for notes and replies view")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user