Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Untitled tab title #2650

Merged
merged 4 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions DuckDuckGo/Common/Localizables/UserText.swift
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ struct UserText {
static let addFolder = NSLocalizedString("menu.add.folder", value: "Add Folder…", comment: "Menu item to add a folder")

static let tabHomeTitle = NSLocalizedString("tab.home.title", value: "New Tab", comment: "Tab home title")
static let tabUntitledTitle = NSLocalizedString("tab.empty.title", value: "Untitled", comment: "Title for an empty tab without a title")
static let tabPreferencesTitle = NSLocalizedString("tab.preferences.title", value: "Settings", comment: "Tab preferences title")
static let tabBookmarksTitle = NSLocalizedString("tab.bookmarks.title", value: "Bookmarks", comment: "Tab bookmarks title")
static let tabOnboardingTitle = NSLocalizedString("tab.onboarding.title", value: "Welcome", comment: "Tab onboarding title")
Expand Down
67 changes: 66 additions & 1 deletion DuckDuckGo/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -20015,6 +20015,7 @@
},
"Hide" : {
"comment" : "Main Menu > View > Home Button > None item\n Preferences > Home Button > None item",
"extractionState" : "extracted_with_value",
"localizations" : {
"de" : {
"stringUnit" : {
Expand Down Expand Up @@ -47964,6 +47965,7 @@
},
"Show left of the back button" : {
"comment" : "Preferences > Home Button > left position item",
"extractionState" : "extracted_with_value",
"localizations" : {
"de" : {
"stringUnit" : {
Expand Down Expand Up @@ -48017,6 +48019,7 @@
},
"Show Left of the Back Button" : {
"comment" : "Main Menu > View > Home Button > left position item",
"extractionState" : "extracted_with_value",
"localizations" : {
"de" : {
"stringUnit" : {
Expand Down Expand Up @@ -48282,6 +48285,7 @@
},
"Show right of the reload button" : {
"comment" : "Preferences > Home Button > right position item",
"extractionState" : "extracted_with_value",
"localizations" : {
"de" : {
"stringUnit" : {
Expand Down Expand Up @@ -48335,6 +48339,7 @@
},
"Show Right of the Reload Button" : {
"comment" : "Main Menu > View > Home Button > right position item",
"extractionState" : "extracted_with_value",
"localizations" : {
"de" : {
"stringUnit" : {
Expand Down Expand Up @@ -49823,6 +49828,66 @@
}
}
},
"tab.empty.title" : {
"comment" : "Title for an empty tab without a title",
"extractionState" : "extracted_with_value",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Ohne Titel"
}
},
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Untitled"
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
"value" : "Sin título"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Sans titre"
}
},
"it" : {
"stringUnit" : {
"state" : "translated",
"value" : "Ohne Titel"
}
},
"nl" : {
"stringUnit" : {
"state" : "translated",
"value" : "Naamloos"
}
},
"pl" : {
"stringUnit" : {
"state" : "translated",
"value" : "Bez tytułu"
}
},
"pt" : {
"stringUnit" : {
"state" : "translated",
"value" : "Sem título"
}
},
"ru" : {
"stringUnit" : {
"state" : "translated",
"value" : "Без названия"
}
}
}
},
"tab.error.title" : {
"comment" : "Tab error title",
"extractionState" : "extracted_with_value",
Expand Down Expand Up @@ -53135,4 +53200,4 @@
}
},
"version" : "1.0"
}
}
5 changes: 4 additions & 1 deletion DuckDuckGo/Tab/ViewModel/TabViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ final class TabViewModel {
}

private func updateTitle() { // swiftlint:disable:this cyclomatic_complexity
let title: String
var title: String
switch tab.content {
// keep an old tab title for web page terminated page, display "Failed to open page" for loading errors
case _ where isShowingErrorPage && (tab.error?.code != .webContentProcessTerminated || tab.title == nil):
Expand Down Expand Up @@ -324,6 +324,9 @@ final class TabViewModel {
title = addressBarString
}
}
if title.isEmpty {
title = UserText.tabUntitledTitle
}
if self.title != title {
self.title = title
}
Expand Down
Loading