Fix localization issues, and export and import translations
This commit is contained in:
@@ -53,18 +53,18 @@ struct EventDetailBar: View {
|
||||
}
|
||||
|
||||
func repostsCountString(_ count: Int, locale: Locale = Locale.current) -> String {
|
||||
let bundle = bundleForLocale(locale: locale)
|
||||
return String(format: bundle.localizedString(forKey: "reposts_count", value: nil, table: nil), locale: locale, count)
|
||||
let format = localizedStringFormat(key: "reposts_count", locale: locale)
|
||||
return String(format: format, locale: locale, count)
|
||||
}
|
||||
|
||||
func reactionsCountString(_ count: Int, locale: Locale = Locale.current) -> String {
|
||||
let bundle = bundleForLocale(locale: locale)
|
||||
return String(format: bundle.localizedString(forKey: "reactions_count", value: nil, table: nil), locale: locale, count)
|
||||
let format = localizedStringFormat(key: "reactions_count", locale: locale)
|
||||
return String(format: format, locale: locale, count)
|
||||
}
|
||||
|
||||
func zapsCountString(_ count: Int, locale: Locale = Locale.current) -> String {
|
||||
let bundle = bundleForLocale(locale: locale)
|
||||
return String(format: bundle.localizedString(forKey: "zaps_count", value: nil, table: nil), locale: locale, count)
|
||||
let format = localizedStringFormat(key: "zaps_count", locale: locale)
|
||||
return String(format: format, locale: locale, count)
|
||||
}
|
||||
|
||||
struct EventDetailBar_Previews: PreviewProvider {
|
||||
|
||||
@@ -32,7 +32,7 @@ struct ShareAction: View {
|
||||
let col = colorScheme == .light ? Color("DamusMediumGrey") : Color("DamusWhite")
|
||||
|
||||
VStack {
|
||||
Text("Share Note")
|
||||
Text("Share Note", comment: "Title text to indicate that the buttons below are meant to be used to share a note with others.")
|
||||
.padding()
|
||||
.font(.system(size: 17, weight: .bold))
|
||||
|
||||
@@ -40,7 +40,7 @@ struct ShareAction: View {
|
||||
|
||||
HStack(alignment: .top, spacing: 25) {
|
||||
|
||||
ShareActionButton(img: "link", txt: "Copy Link", comment: "Button to copy link to note", col: col) {
|
||||
ShareActionButton(img: "link", text: NSLocalizedString("Copy Link", comment: "Button to copy link to note"), col: col) {
|
||||
show_share_action = false
|
||||
UIPasteboard.general.string = "https://damus.io/" + (bech32_note_id(event.id) ?? event.id)
|
||||
}
|
||||
@@ -48,18 +48,18 @@ struct ShareAction: View {
|
||||
let bookmarkImg = isBookmarked ? "bookmark.slash" : "bookmark"
|
||||
let bookmarkTxt = isBookmarked ? "Remove\nBookmark" : "Bookmark"
|
||||
let boomarkCol = isBookmarked ? Color(.red) : col
|
||||
ShareActionButton(img: bookmarkImg, txt: bookmarkTxt, comment: "Button to bookmark to note", col: boomarkCol) {
|
||||
ShareActionButton(img: bookmarkImg, text: NSLocalizedString(bookmarkTxt, comment: "Button to bookmark to note"), col: boomarkCol) {
|
||||
show_share_action = false
|
||||
self.bookmarks.updateBookmark(event)
|
||||
isBookmarked = self.bookmarks.isBookmarked(event)
|
||||
}
|
||||
|
||||
ShareActionButton(img: "globe", txt: "Broadcast", comment: "Button to broadcast note to all your relays", col: col) {
|
||||
ShareActionButton(img: "globe", text: NSLocalizedString("Broadcast", comment: "Button to broadcast note to all your relays"), col: col) {
|
||||
show_share_action = false
|
||||
NotificationCenter.default.post(name: .broadcast_event, object: event)
|
||||
}
|
||||
|
||||
ShareActionButton(img: "square.and.arrow.up", txt: "Share Via...", comment: "Button to present iOS share sheet", col: col) {
|
||||
ShareActionButton(img: "square.and.arrow.up", text: NSLocalizedString("Share Via...", comment: "Button to present iOS share sheet"), col: col) {
|
||||
show_share_action = false
|
||||
show_share_sheet = true
|
||||
}
|
||||
@@ -87,7 +87,7 @@ struct ShareAction: View {
|
||||
}
|
||||
}
|
||||
|
||||
func ShareActionButton(img: String, txt: String, comment: String, col: Color, action: @escaping () -> ()) -> some View {
|
||||
func ShareActionButton(img: String, text: String, col: Color, action: @escaping () -> ()) -> some View {
|
||||
Button(action: action) {
|
||||
VStack() {
|
||||
Image(systemName: img)
|
||||
@@ -99,7 +99,7 @@ func ShareActionButton(img: String, txt: String, comment: String, col: Color, ac
|
||||
.frame(width: 55.0, height: 55.0)
|
||||
}
|
||||
.frame(height: 25)
|
||||
Text(NSLocalizedString(txt, comment: comment))
|
||||
Text(verbatim: text)
|
||||
.foregroundColor(col)
|
||||
.font(.footnote)
|
||||
.multilineTextAlignment(.center)
|
||||
|
||||
Reference in New Issue
Block a user