Skip to content

Commit

Permalink
Fix text with markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
Bunn committed Oct 30, 2024
1 parent 87ed70b commit 866c9f6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,14 @@ struct AIChatToolBarPopUpOnboardingView: View {
Text(UserText.aiChatOnboardingPopoverTitle)
.font(.headline)

Text(UserText.aiChatOnboardingPopoverMessage1) +
Text(" ") +
Text(UserText.aiChatOnboardingPopoverMessage2).bold()
if #available(macOS 12, *) {
// Use Markdown for macOS 12 and newer
// .init is required for markdown to be correctly parsed from NSLocalizedString
Text(.init(UserText.aiChatOnboardingPopoverMessageMarkdown))
} else {
// Fallback for earlier macOS versions
Text(UserText.aiChatOnboardingPopoverMessageFallback)
}
}

HStack {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,18 @@ struct BookmarksBarPromptView: View {
.font(.system(size: 15).weight(.semibold))
.padding(.bottom, 16)

Group {
Text(UserText.bookmarksBarPromptMessage1)
.font(.system(size: 13)) +
Text(" ") +
Text(UserText.bookmarksBarPromptMessage2)
.font(.system(size: 13, weight: .bold))
if #available(macOS 12, *) {
// Use Markdown for macOS 12 and newer
// .init is required for markdown to be correctly parsed from NSLocalizedString
Text(.init(UserText.bookmarksBarPromptMessageMarkdown))
.font(.system(size: 13))
.padding(.bottom, 20)
} else {
// Fallback for earlier macOS versions
Text(UserText.bookmarksBarPromptMessageFallback)
.font(.system(size: 13))
.padding(.bottom, 20)
}
.padding(.bottom, 20)

HStack {
Button {
Expand Down
8 changes: 4 additions & 4 deletions DuckDuckGo/Common/Localizables/UserText.swift
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,8 @@ struct UserText {

// AI Chat
static let aiChatOnboardingPopoverTitle = NSLocalizedString("ai-chat.onboarding.popover.title", value: "Launch AI Chat directly from your toolbar", comment: "AI Chat onboarding popover title")
static let aiChatOnboardingPopoverMessage1 = NSLocalizedString("ai-chat.onboarding.popover.message1", value: "You can adjust this and other AI Chat features in", comment: "AI Chat onboarding popover message")
static let aiChatOnboardingPopoverMessage2 = NSLocalizedString("ai-chat.onboarding.popover.message2", value: "Settings > AI Chat.", comment: "AI Chat onboarding popover message continuation")
static let aiChatOnboardingPopoverMessageMarkdown = NSLocalizedString("ai-chat.onboarding.popover.message-markdown", value: "You can adjust this and other AI Chat features in **Settings** > **AI Chat**.", comment: "AI Chat onboarding popover message, make sure to keep Settings and AI Chat inside ** **")
static let aiChatOnboardingPopoverMessageFallback = NSLocalizedString("ai-chat.onboarding.popover.message-fallback", value: "You can adjust this and other AI Chat features in Settings > AI Chat", comment: "AI Chat onboarding popover message continuation")
static let aiChatOnboardingPopoverCTAReject = NSLocalizedString("ai-chat.onboarding.popover.reject", value: "No Thanks", comment: "AI Chat onboarding CTA for rejection")
static let aiChatOnboardingPopoverCTAAccept = NSLocalizedString("ai-chat.onboarding.popover.accept", value: "Add Shortcut", comment: "AI Chat onboarding CTA for approval")
static let aiChatOnboardingPopoverConfirmation = NSLocalizedString("ai-chat.onboarding.popover.confirmation", value: "AI Chat shortcut added!", comment: "Confirmation for accepting the AI Chat onboarding popover")
Expand Down Expand Up @@ -1189,8 +1189,8 @@ struct UserText {

// Bookmarks bar prompt
static let bookmarksBarPromptTitle = NSLocalizedString("bookmarks.bar.prompt.title", value: "Show Bookmarks Bar?", comment: "Title for bookmarks bar prompt")
static let bookmarksBarPromptMessage1 = NSLocalizedString("bookmarks.bar.prompt.message1", value: "Show the Bookmarks Bar for quick access to your favorite bookmarks. You can adjust this later in", comment: "First part for message show for bookmarks bar prompt")
static let bookmarksBarPromptMessage2 = NSLocalizedString("bookmarks.bar.prompt.message2", value: "Settings > Appearance.", comment: "Second part for message show for bookmarks bar prompt")
static let bookmarksBarPromptMessageMarkdown = NSLocalizedString("bookmarks.bar.prompt.message1", value: "Show the Bookmarks Bar for quick access to your favorite bookmarks. You can adjust this later in **Settings** > **Appearance**.", comment: " message with markdown show for bookmarks bar prompt, make sure to keep the ** ** for the translated words Settings and Appearance")
static let bookmarksBarPromptMessageFallback = NSLocalizedString("bookmarks.bar.prompt.message1", value: "Show the Bookmarks Bar for quick access to your favorite bookmarks. You can adjust this later in Settings > Appearance.", comment: " message show for bookmarks bar prompt")

static let bookmarksBarPromptDismiss = NSLocalizedString("bookmarks.bar.prompt.dismiss", value: "Hide", comment: "Dismiss button label on bookmarks bar prompt")
static let bookmarksBarPromptAccept = NSLocalizedString("bookmarks.bar.prompt.accept", value: "Show", comment: "Accept button label on bookmarks bar prompt")
Expand Down

0 comments on commit 866c9f6

Please sign in to comment.