[NTP Next] Add News strings and mojo connector (#28696)
This commit is contained in:
@@ -609,6 +609,7 @@ void BraveContentBrowserClient::RegisterWebUIInterfaceBrokers(
|
||||
registry.ForWebUI<BraveNewTabPageUI>()
|
||||
.Add<brave_new_tab_page_refresh::mojom::NewTabPageHandler>()
|
||||
.Add<brave_rewards::mojom::RewardsPageHandler>()
|
||||
.Add<brave_news::mojom::BraveNewsController>()
|
||||
.Add<
|
||||
ntp_background_images::mojom::SponsoredRichMediaAdEventHandler>();
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ transpile_web_ui("resources") {
|
||||
deps = [
|
||||
"//brave/browser/ui/webui/brave_new_tab_page_refresh:mojom_js",
|
||||
"//brave/components/brave_ads/core/mojom:mojom_js",
|
||||
"//brave/components/brave_news/common:mojom_js",
|
||||
"//brave/components/brave_rewards/core/mojom:webui_js",
|
||||
"//brave/components/brave_vpn/common/mojom:mojom_js",
|
||||
"//brave/components/ntp_background_images/browser/mojom:mojom_js",
|
||||
|
||||
@@ -5,12 +5,7 @@
|
||||
|
||||
import * as React from 'react'
|
||||
|
||||
import { StringKey } from '../../models/locale_strings'
|
||||
|
||||
export interface Locale {
|
||||
getString: (key: StringKey) => string
|
||||
getPluralString: (key: StringKey, count: number) => Promise<string>
|
||||
}
|
||||
import { Locale, PluralStringKey } from '../../models/locale_strings'
|
||||
|
||||
const Context = React.createContext<Locale>({
|
||||
getString: () => '',
|
||||
@@ -35,7 +30,7 @@ export function useLocale(): Locale {
|
||||
}
|
||||
|
||||
export function usePluralString(
|
||||
key: StringKey,
|
||||
key: PluralStringKey,
|
||||
count: number | undefined | null
|
||||
) {
|
||||
const locale = useLocale()
|
||||
|
||||
@@ -23,6 +23,69 @@ export type StringKey =
|
||||
'gradientBackgroundLabel' |
|
||||
'gradientBackgroundTitle' |
|
||||
'hideTopSitesLabel' |
|
||||
'newsAddSourcesButtonLabel' |
|
||||
'newsBackButtonLabel' |
|
||||
'newsCaughtUpText' |
|
||||
'newsChannelBrave' |
|
||||
'newsChannelBusiness' |
|
||||
'newsChannelCars' |
|
||||
'newsChannelCelebrities' |
|
||||
'newsChannelCrypto' |
|
||||
'newsChannelCulture' |
|
||||
'newsChannelEducation' |
|
||||
'newsChannelEntertainment' |
|
||||
'newsChannelFashion' |
|
||||
'newsChannelFilmAndTV' |
|
||||
'newsChannelFood' |
|
||||
'newsChannelFun' |
|
||||
'newsChannelGaming' |
|
||||
'newsChannelHealth' |
|
||||
'newsChannelHome' |
|
||||
'newsChannelLifestyle' |
|
||||
'newsChannelMusic' |
|
||||
'newsChannelPolitics' |
|
||||
'newsChannelRegionalNews' |
|
||||
'newsChannelScience' |
|
||||
'newsChannelSports' |
|
||||
'newsChannelTravel' |
|
||||
'newsChannelTechnology' |
|
||||
'newsChannelTopNews' |
|
||||
'newsChannelTopSources' |
|
||||
'newsChannelUKNews' |
|
||||
'newsChannelUSNews' |
|
||||
'newsChannelWeather' |
|
||||
'newsChannelWorldNews' |
|
||||
'newsConnectionErrorText' |
|
||||
'newsConnectionErrorTitle' |
|
||||
'newsContentAvailableButtonLabel' |
|
||||
'newsDiscoverTitle' |
|
||||
'newsEnableButtonLabel' |
|
||||
'newsEnableText' |
|
||||
'newsFeedAllTitle' |
|
||||
'newsFeedChannelsTitle' |
|
||||
'newsFeedFollowingTitle' |
|
||||
'newsFeedPublishersTitle' |
|
||||
'newsHidePublisherLabel' |
|
||||
'newsNoArticlesText' |
|
||||
'newsNoArticlesTitle' |
|
||||
'newsNoFeedsText' |
|
||||
'newsNoFeedsTitle' |
|
||||
'newsNoMatchingFeedsText' |
|
||||
'newsQueryTooShortText' |
|
||||
'newsRefreshButtonLabel' |
|
||||
'newsSearchFeedsButtonLabel' |
|
||||
'newsSettingsChannelsTitle' |
|
||||
'newsSettingsDiscoverTitle' |
|
||||
'newsSettingsFollowingTitle' |
|
||||
'newsSettingsPopularTitle' |
|
||||
'newsSettingsQueryPlaceholder' |
|
||||
'newsSettingsSourcesTitle' |
|
||||
'newsSettingsSuggestionsText' |
|
||||
'newsSettingsSuggestionsTitle' |
|
||||
'newsSettingsTitle' |
|
||||
'newsUnfollowButtonLabel' |
|
||||
'newsViewAllButtonLabel' |
|
||||
'newsWidgetTitle' |
|
||||
'photoCreditsText' |
|
||||
'randomizeBackgroundLabel' |
|
||||
'removeTopSiteLabel' |
|
||||
@@ -48,6 +111,7 @@ export type StringKey =
|
||||
'settingsTitle' |
|
||||
'showBackgroundsLabel' |
|
||||
'showClockLabel' |
|
||||
'showNewsWidgetLabel' |
|
||||
'showRewardsWidgetLabel' |
|
||||
'showSearchBoxLabel' |
|
||||
'showSponsoredImagesLabel' |
|
||||
@@ -92,3 +156,11 @@ export type StringKey =
|
||||
'vpnStatusDisconnecting' |
|
||||
'vpnWidgetTitle' |
|
||||
'widgetSettingsTitle'
|
||||
|
||||
export type PluralStringKey =
|
||||
'newsSourceCountText'
|
||||
|
||||
export interface Locale {
|
||||
getString: (key: StringKey) => string
|
||||
getPluralString: (key: PluralStringKey, count: number) => Promise<string>
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
import { StringKey } from '../models/locale_strings'
|
||||
import { StringKey, PluralStringKey, Locale } from '../models/locale_strings'
|
||||
|
||||
const localeStrings: { [K in StringKey]: string } = {
|
||||
const localeStrings: Record<StringKey, string> = {
|
||||
addTopSiteLabel: 'Add site',
|
||||
addTopSiteTitle: 'Add site',
|
||||
backgroundSettingsTitle: 'Background Image',
|
||||
@@ -25,6 +25,69 @@ const localeStrings: { [K in StringKey]: string } = {
|
||||
gradientBackgroundLabel: 'Gradients',
|
||||
gradientBackgroundTitle: 'Gradients',
|
||||
hideTopSitesLabel: 'Hide top sites',
|
||||
newsAddSourcesButtonLabel: 'Add content sources',
|
||||
newsBackButtonLabel: 'Back',
|
||||
newsCaughtUpText: 'You\'re all caught up',
|
||||
newsChannelBrave: 'Brave',
|
||||
newsChannelBusiness: 'Business',
|
||||
newsChannelCars: 'Cars',
|
||||
newsChannelCelebrities: 'Celebrities',
|
||||
newsChannelCrypto: 'Crypto',
|
||||
newsChannelCulture: 'Culture',
|
||||
newsChannelEducation: 'Education',
|
||||
newsChannelEntertainment: 'Entertainment',
|
||||
newsChannelFashion: 'Fashion',
|
||||
newsChannelFilmAndTV: 'Film and TV',
|
||||
newsChannelFood: 'Food',
|
||||
newsChannelFun: 'Fun',
|
||||
newsChannelGaming: 'Gaming',
|
||||
newsChannelHealth: 'Health',
|
||||
newsChannelHome: 'Home',
|
||||
newsChannelLifestyle: 'Lifestyle',
|
||||
newsChannelMusic: 'Music',
|
||||
newsChannelPolitics: 'Politics',
|
||||
newsChannelRegionalNews: 'Regional News',
|
||||
newsChannelScience: 'Science',
|
||||
newsChannelSports: 'Sports',
|
||||
newsChannelTravel: 'Travel',
|
||||
newsChannelTechnology: 'Technology',
|
||||
newsChannelTopNews: 'Top News',
|
||||
newsChannelTopSources: 'Top Sources',
|
||||
newsChannelUKNews: 'UK News',
|
||||
newsChannelUSNews: 'US News',
|
||||
newsChannelWeather: 'Weather',
|
||||
newsChannelWorldNews: 'World News',
|
||||
newsConnectionErrorText: 'Check your internet connection and refresh',
|
||||
newsConnectionErrorTitle: 'You appear to be offline',
|
||||
newsContentAvailableButtonLabel: 'New content available. Reload?',
|
||||
newsDiscoverTitle: 'You might also like',
|
||||
newsEnableButtonLabel: 'Turn on Brave News',
|
||||
newsEnableText: 'Turn on Brave News, and never miss a story',
|
||||
newsFeedAllTitle: 'For You',
|
||||
newsFeedChannelsTitle: 'Channels',
|
||||
newsFeedFollowingTitle: 'Following',
|
||||
newsFeedPublishersTitle: 'Publishers',
|
||||
newsHidePublisherLabel: 'Hide content from $1',
|
||||
newsNoArticlesText: 'There don\'t seem to be any articles in this feed at this moment. Try coming back later or refreshing the feed.',
|
||||
newsNoArticlesTitle: 'This feed is empty',
|
||||
newsNoFeedsText: 'Follow publishers and channels to see them in your feed.',
|
||||
newsNoFeedsTitle: 'Your Feed is Empty',
|
||||
newsNoMatchingFeedsText: 'No feeds found at $1',
|
||||
newsQueryTooShortText: 'Keep typing to search sources',
|
||||
newsRefreshButtonLabel: 'Refresh',
|
||||
newsSearchFeedsButtonLabel: 'Get feeds from $1',
|
||||
newsSettingsChannelsTitle: 'Channels',
|
||||
newsSettingsDiscoverTitle: 'Discover',
|
||||
newsSettingsFollowingTitle: 'Following',
|
||||
newsSettingsPopularTitle: 'Popular',
|
||||
newsSettingsQueryPlaceholder: 'Search for site, topic, or RSS feed',
|
||||
newsSettingsSourcesTitle: 'Sources',
|
||||
newsSettingsSuggestionsText: 'Some sources you might like. Suggestions are anonymous and matched only on your device.',
|
||||
newsSettingsSuggestionsTitle: 'Suggestions',
|
||||
newsSettingsTitle: 'News and RSS',
|
||||
newsUnfollowButtonLabel: 'Unfollow',
|
||||
newsViewAllButtonLabel: 'View all',
|
||||
newsWidgetTitle: 'NEWS',
|
||||
photoCreditsText: 'Photo by $1',
|
||||
randomizeBackgroundLabel: 'Refresh on every new tab',
|
||||
removeTopSiteLabel: 'Remove',
|
||||
@@ -50,6 +113,7 @@ const localeStrings: { [K in StringKey]: string } = {
|
||||
settingsTitle: 'Customize Dashboard',
|
||||
showBackgroundsLabel: 'Show Background Images',
|
||||
showClockLabel: 'Show clock',
|
||||
showNewsWidgetLabel: 'News and RSS',
|
||||
showRewardsWidgetLabel: 'Brave Rewards',
|
||||
showSearchBoxLabel: 'Show search widget in new tabs',
|
||||
showSponsoredImagesLabel: 'Show Sponsored Images',
|
||||
@@ -96,13 +160,18 @@ const localeStrings: { [K in StringKey]: string } = {
|
||||
widgetSettingsTitle: 'Widgets'
|
||||
}
|
||||
|
||||
export function createLocale() {
|
||||
const getString =
|
||||
(key: string) => String((localeStrings as any)[key] || 'MISSING')
|
||||
const pluralStrings: Record<PluralStringKey, string> = {
|
||||
newsSourceCountText: '# sources'
|
||||
}
|
||||
|
||||
export function createLocale(): Locale {
|
||||
return {
|
||||
getString,
|
||||
async getPluralString (key: string, count: number) {
|
||||
return getString(key).replace('#', String(count))
|
||||
getString(key) {
|
||||
return localeStrings[key] ?? 'MISSING'
|
||||
},
|
||||
async getPluralString (key, count) {
|
||||
const message = pluralStrings[key] ?? 'MISSING'
|
||||
return message.replace('#', String(count))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,15 +4,17 @@
|
||||
* You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
import { loadTimeData } from 'chrome://resources/js/load_time_data.js'
|
||||
import { PluralStringProxyImpl } from 'chrome://resources/js/plural_string_proxy.js'
|
||||
import { Locale } from '../models/locale_strings'
|
||||
|
||||
export function createLocale() {
|
||||
export function createLocale(): Locale {
|
||||
return {
|
||||
getString(key: string) {
|
||||
getString(key) {
|
||||
return loadTimeData.getString(key)
|
||||
},
|
||||
|
||||
async getPluralString(key: string, count: number) {
|
||||
throw new Error('Not implemented')
|
||||
async getPluralString(key, count) {
|
||||
return PluralStringProxyImpl.getInstance().getPluralString(key, count)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,8 @@ source_set("brave_new_tab_page_refresh") {
|
||||
"//brave/browser/misc_metrics",
|
||||
"//brave/browser/ntp_background",
|
||||
"//brave/browser/resources/brave_new_tab_page_refresh:generated_resources",
|
||||
"//brave/components/brave_news/browser",
|
||||
"//brave/components/brave_news/common:mojom",
|
||||
"//brave/components/brave_perf_predictor/common",
|
||||
"//brave/components/brave_rewards/core/mojom:webui",
|
||||
"//brave/components/brave_search_conversion",
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "brave/browser/brave_ads/ads_service_factory.h"
|
||||
#include "brave/browser/brave_browser_process.h"
|
||||
#include "brave/browser/brave_news/brave_news_controller_factory.h"
|
||||
#include "brave/browser/brave_rewards/rewards_service_factory.h"
|
||||
#include "brave/browser/misc_metrics/process_misc_metrics.h"
|
||||
#include "brave/browser/ntp_background/brave_ntp_custom_background_service_factory.h"
|
||||
@@ -22,6 +23,7 @@
|
||||
#include "brave/browser/ui/webui/brave_new_tab_page_refresh/top_sites_facade.h"
|
||||
#include "brave/browser/ui/webui/brave_new_tab_page_refresh/vpn_facade.h"
|
||||
#include "brave/browser/ui/webui/brave_rewards/rewards_page_handler.h"
|
||||
#include "brave/components/brave_news/browser/brave_news_controller.h"
|
||||
#include "brave/components/ntp_background_images/browser/ntp_sponsored_rich_media_ad_event_handler.h"
|
||||
#include "brave/components/ntp_background_images/browser/view_counter_service.h"
|
||||
#include "chrome/browser/browser_process.h"
|
||||
@@ -48,7 +50,7 @@ using brave_new_tab_page_refresh::VPNFacade;
|
||||
} // namespace
|
||||
|
||||
BraveNewTabPageUI::BraveNewTabPageUI(content::WebUI* web_ui)
|
||||
: ui::MojoWebUIController(web_ui) {
|
||||
: ui::MojoWebUIController(web_ui, /* enable_chrome_send = */ true) {
|
||||
NewTabPageInitializer(*web_ui).Initialize();
|
||||
}
|
||||
|
||||
@@ -120,6 +122,16 @@ void BraveNewTabPageUI::BindInterface(
|
||||
profile->GetPrefs());
|
||||
}
|
||||
|
||||
void BraveNewTabPageUI::BindInterface(
|
||||
mojo::PendingReceiver<brave_news::mojom::BraveNewsController> receiver) {
|
||||
auto* profile = Profile::FromWebUI(web_ui());
|
||||
auto* brave_news_controller =
|
||||
brave_news::BraveNewsControllerFactory::GetForBrowserContext(profile);
|
||||
if (brave_news_controller) {
|
||||
brave_news_controller->Bind(std::move(receiver));
|
||||
}
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_VPN)
|
||||
void BraveNewTabPageUI::BindInterface(
|
||||
mojo::PendingReceiver<brave_vpn::mojom::ServiceHandler> receiver) {
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <memory>
|
||||
|
||||
#include "brave/browser/ui/webui/brave_new_tab_page_refresh/brave_new_tab_page.mojom.h"
|
||||
#include "brave/components/brave_news/common/brave_news.mojom-forward.h"
|
||||
#include "brave/components/brave_rewards/core/mojom/rewards_page.mojom.h"
|
||||
#include "brave/components/brave_vpn/common/buildflags/buildflags.h"
|
||||
#include "brave/components/ntp_background_images/browser/mojom/ntp_background_images.mojom.h"
|
||||
@@ -51,6 +52,9 @@ class BraveNewTabPageUI : public ui::MojoWebUIController {
|
||||
void BindInterface(
|
||||
mojo::PendingReceiver<brave_rewards::mojom::RewardsPageHandler> receiver);
|
||||
|
||||
void BindInterface(
|
||||
mojo::PendingReceiver<brave_news::mojom::BraveNewsController> receiver);
|
||||
|
||||
#if BUILDFLAG(ENABLE_BRAVE_VPN)
|
||||
void BindInterface(
|
||||
mojo::PendingReceiver<brave_vpn::mojom::ServiceHandler> receiver);
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
#include "chrome/browser/themes/theme_syncable_service.h"
|
||||
#include "chrome/browser/ui/webui/favicon_source.h"
|
||||
#include "chrome/browser/ui/webui/plural_string_handler.h"
|
||||
#include "chrome/browser/ui/webui/sanitized_image_source.h"
|
||||
#include "chrome/common/webui_url_constants.h"
|
||||
#include "components/favicon_base/favicon_url_parser.h"
|
||||
@@ -61,6 +62,7 @@ void NewTabPageInitializer::Initialize() {
|
||||
AddCSPOverrides();
|
||||
AddLoadTimeValues();
|
||||
AddStrings();
|
||||
AddPluralStrings();
|
||||
|
||||
AddFaviconDataSource();
|
||||
AddCustomImageDataSource();
|
||||
@@ -137,6 +139,69 @@ void NewTabPageInitializer::AddStrings() {
|
||||
{"gradientBackgroundLabel", IDS_NEW_TAB_GRADIENT_BACKGROUND_LABEL},
|
||||
{"gradientBackgroundTitle", IDS_NEW_TAB_GRADIENT_BACKGROUND_LABEL},
|
||||
{"hideTopSitesLabel", IDS_NEW_TAB_HIDE_TOP_SITES_LABEL},
|
||||
{"newsAddSourcesButtonLabel", IDS_BRAVE_NEWS_NO_CONTENT_ACTION_LABEL},
|
||||
{"newsBackButtonLabel", IDS_BRAVE_NEWS_BACK_BUTTON},
|
||||
{"newsCaughtUpText", IDS_BRAVE_NEWS_CAUGHT_UP},
|
||||
{"newsChannelBrave", IDS_BRAVE_NEWS_CHANNEL_BRAVE},
|
||||
{"newsChannelBusiness", IDS_BRAVE_NEWS_CHANNEL_BUSINESS},
|
||||
{"newsChannelCars", IDS_BRAVE_NEWS_CHANNEL_CARS},
|
||||
{"newsChannelCelebrities", IDS_BRAVE_NEWS_CHANNEL_CELEBRITIES},
|
||||
{"newsChannelCrypto", IDS_BRAVE_NEWS_CHANNEL_CRYPTO},
|
||||
{"newsChannelCulture", IDS_BRAVE_NEWS_CHANNEL_CULTURE},
|
||||
{"newsChannelEducation", IDS_BRAVE_NEWS_CHANNEL_EDUCATION},
|
||||
{"newsChannelEntertainment", IDS_BRAVE_NEWS_CHANNEL_ENTERTAINMENT},
|
||||
{"newsChannelFashion", IDS_BRAVE_NEWS_CHANNEL_FASHION},
|
||||
{"newsChannelFilmAndTV", IDS_BRAVE_NEWS_CHANNEL_FILM_AND_TV},
|
||||
{"newsChannelFood", IDS_BRAVE_NEWS_CHANNEL_FOOD},
|
||||
{"newsChannelFun", IDS_BRAVE_NEWS_CHANNEL_FUN},
|
||||
{"newsChannelGaming", IDS_BRAVE_NEWS_CHANNEL_GAMING},
|
||||
{"newsChannelHealth", IDS_BRAVE_NEWS_CHANNEL_HEALTH},
|
||||
{"newsChannelHome", IDS_BRAVE_NEWS_CHANNEL_HOME},
|
||||
{"newsChannelLifestyle", IDS_BRAVE_NEWS_CHANNEL_LIFESTYLE},
|
||||
{"newsChannelMusic", IDS_BRAVE_NEWS_CHANNEL_MUSIC},
|
||||
{"newsChannelPolitics", IDS_BRAVE_NEWS_CHANNEL_POLITICS},
|
||||
{"newsChannelRegionalNews", IDS_BRAVE_NEWS_CHANNEL_REGIONAL_NEWS},
|
||||
{"newsChannelScience", IDS_BRAVE_NEWS_CHANNEL_SCIENCE},
|
||||
{"newsChannelSports", IDS_BRAVE_NEWS_CHANNEL_SPORTS},
|
||||
{"newsChannelTravel", IDS_BRAVE_NEWS_CHANNEL_TRAVEL},
|
||||
{"newsChannelTechnology", IDS_BRAVE_NEWS_CHANNEL_TECHNOLOGY},
|
||||
{"newsChannelTopNews", IDS_BRAVE_NEWS_CHANNEL_TOP_NEWS},
|
||||
{"newsChannelTopSources", IDS_BRAVE_NEWS_CHANNEL_TOP_SOURCES},
|
||||
{"newsChannelUKNews", IDS_BRAVE_NEWS_CHANNEL_UK_NEWS},
|
||||
{"newsChannelUSNews", IDS_BRAVE_NEWS_CHANNEL_US_NEWS},
|
||||
{"newsChannelWeather", IDS_BRAVE_NEWS_CHANNEL_WEATHER},
|
||||
{"newsChannelWorldNews", IDS_BRAVE_NEWS_CHANNEL_WORLD_NEWS},
|
||||
{"newsConnectionErrorText", IDS_BRAVE_NEWS_OFFLINE_MESSAGE},
|
||||
{"newsConnectionErrorTitle", IDS_BRAVE_NEWS_OFFLINE_TITLE},
|
||||
{"newsContentAvailableButtonLabel", IDS_BRAVE_NEWS_NEW_CONTENT_AVAILABLE},
|
||||
{"newsDiscoverTitle", IDS_BRAVE_NEWS_SOURCES_RECOMMENDATION},
|
||||
{"newsEnableButtonLabel", IDS_BRAVE_NEWS_OPT_IN_ACTION_LABEL},
|
||||
{"newsEnableText", IDS_BRAVE_NEWS_INTRO_TITLE},
|
||||
{"newsFeedAllTitle", IDS_BRAVE_NEWS_FOR_YOU_FEED},
|
||||
{"newsFeedChannelsTitle", IDS_BRAVE_NEWS_BROWSE_CHANNELS_HEADER},
|
||||
{"newsFeedFollowingTitle", IDS_BRAVE_NEWS_FEEDS_HEADING},
|
||||
{"newsFeedPublishersTitle", IDS_BRAVE_NEWS_PUBLISHERS_HEADING},
|
||||
{"newsHidePublisherLabel", IDS_BRAVE_NEWS_HIDE_CONTENT_FROM},
|
||||
{"newsNoArticlesText", IDS_BRAVE_NEWS_NO_ARTICLES_MESSAGE},
|
||||
{"newsNoArticlesTitle", IDS_BRAVE_NEWS_NO_ARTICLES_TITLE},
|
||||
{"newsNoFeedsText", IDS_BRAVE_NEWS_NO_CONTENT_MESSAGE},
|
||||
{"newsNoFeedsTitle", IDS_BRAVE_NEWS_NO_CONTENT_HEADING},
|
||||
{"newsNoMatchingFeedsText", IDS_BRAVE_NEWS_DIRECT_SEARCH_NO_RESULTS},
|
||||
{"newsQueryTooShortText", IDS_BRAVE_NEWS_SEARCH_QUERY_TOO_SHORT},
|
||||
{"newsRefreshButtonLabel", IDS_BRAVE_NEWS_REFRESH_FEED},
|
||||
{"newsSearchFeedsButtonLabel", IDS_BRAVE_NEWS_DIRECT_SEARCH_BUTTON},
|
||||
{"newsSettingsChannelsTitle", IDS_BRAVE_NEWS_BROWSE_CHANNELS_HEADER},
|
||||
{"newsSettingsDiscoverTitle", IDS_BRAVE_NEWS_DISCOVER_TITLE},
|
||||
{"newsSettingsFollowingTitle", IDS_BRAVE_NEWS_FEEDS_HEADING},
|
||||
{"newsSettingsPopularTitle", IDS_BRAVE_NEWS_POPULAR_TITLE},
|
||||
{"newsSettingsQueryPlaceholder", IDS_BRAVE_NEWS_SEARCH_PLACEHOLDER_LABEL},
|
||||
{"newsSettingsSourcesTitle", IDS_BRAVE_NEWS_ALL_SOURCES_HEADER},
|
||||
{"newsSettingsSuggestionsText", IDS_BRAVE_NEWS_SUGGESTIONS_SUBTITLE},
|
||||
{"newsSettingsSuggestionsTitle", IDS_BRAVE_NEWS_SUGGESTIONS_TITLE},
|
||||
{"newsSettingsTitle", IDS_BRAVE_NEWS_SETTINGS_TITLE},
|
||||
{"newsUnfollowButtonLabel", IDS_BRAVE_NEWS_FOLLOW_BUTTON_FOLLOWING},
|
||||
{"newsViewAllButtonLabel", IDS_BRAVE_NEWS_VIEW_ALL_BUTTON},
|
||||
{"newsWidgetTitle", IDS_NEW_TAB_NEWS_WIDGET_TITLE},
|
||||
{"photoCreditsText", IDS_NEW_TAB_PHOTO_CREDITS_TEXT},
|
||||
{"randomizeBackgroundLabel", IDS_NEW_TAB_RANDOMIZE_BACKGROUND_LABEL},
|
||||
{"removeTopSiteLabel", IDS_NEW_TAB_REMOVE_TOP_SITE_LABEL},
|
||||
@@ -169,6 +234,7 @@ void NewTabPageInitializer::AddStrings() {
|
||||
{"settingsTitle", IDS_NEW_TAB_SETTINGS_TITLE},
|
||||
{"showBackgroundsLabel", IDS_NEW_TAB_SHOW_BACKGROUNDS_LABEL},
|
||||
{"showClockLabel", IDS_NEW_TAB_SHOW_CLOCK_LABEL},
|
||||
{"showNewsWidgetLabel", IDS_NEW_TAB_SHOW_NEWS_WIDGET_LABEL},
|
||||
{"showRewardsWidgetLabel", IDS_NEW_TAB_SHOW_REWARDS_WIDGET_LABEL},
|
||||
{"showSearchBoxLabel", IDS_NEW_TAB_SHOW_SEARCH_BOX_LABEL},
|
||||
{"showSponsoredImagesLabel", IDS_NEW_TAB_SHOW_SPONSORED_IMAGES_LABEL},
|
||||
@@ -220,6 +286,13 @@ void NewTabPageInitializer::AddStrings() {
|
||||
source_->AddLocalizedStrings(kStrings);
|
||||
}
|
||||
|
||||
void NewTabPageInitializer::AddPluralStrings() {
|
||||
auto handler = std::make_unique<PluralStringHandler>();
|
||||
handler->AddLocalizedString("newsSourceCountText",
|
||||
IDS_BRAVE_NEWS_SOURCE_COUNT);
|
||||
web_ui_->AddMessageHandler(std::move(handler));
|
||||
}
|
||||
|
||||
void NewTabPageInitializer::AddFaviconDataSource() {
|
||||
auto* profile = GetProfile();
|
||||
content::URLDataSource::Add(
|
||||
|
||||
@@ -36,6 +36,7 @@ class NewTabPageInitializer {
|
||||
void AddCSPOverrides();
|
||||
void AddLoadTimeValues();
|
||||
void AddStrings();
|
||||
void AddPluralStrings();
|
||||
void AddFaviconDataSource();
|
||||
void AddCustomImageDataSource();
|
||||
void AddSanitizedImageDataSource();
|
||||
|
||||
@@ -69,6 +69,10 @@
|
||||
Hide top sites
|
||||
</message>
|
||||
|
||||
<message name="IDS_NEW_TAB_NEWS_WIDGET_TITLE" desc="Title for Brave News widget">
|
||||
NEWS
|
||||
</message>
|
||||
|
||||
<message name="IDS_NEW_TAB_PHOTO_CREDITS_TEXT" desc="Photographer credits for Brave background images">
|
||||
Photo by <ph name="AUTHOR">$1</ph>
|
||||
</message>
|
||||
@@ -157,6 +161,10 @@
|
||||
Show clock
|
||||
</message>
|
||||
|
||||
<message name="IDS_NEW_TAB_SHOW_NEWS_WIDGET_LABEL" desc="Label for enabling the News widget on the NTP">
|
||||
News and RSS
|
||||
</message>
|
||||
|
||||
<message name="IDS_NEW_TAB_SHOW_REWARDS_WIDGET_LABEL" desc="Label for enabling the Rewards widget on the NTP">
|
||||
Brave Rewards
|
||||
</message>
|
||||
|
||||
@@ -15,12 +15,18 @@
|
||||
<message name="IDS_BRAVE_NEWS_OPT_OUT_ACTION_LABEL" desc="Button text for opting out of Brave News">
|
||||
No thanks
|
||||
</message>
|
||||
<message name="IDS_BRAVE_NEWS_SETTINGS_TITLE" desc="Title for the News settings dialog">
|
||||
News and RSS
|
||||
</message>
|
||||
<message name="IDS_BRAVE_NEWS_BACK_TO_DASHBOARD" desc="Label for the back to dashboard button">
|
||||
Back to <ph name="BEGIN_BOLD">$1</ph>Dashboard<ph name="END_BOLD">$2</ph>
|
||||
</message>
|
||||
<message name="IDS_BRAVE_NEWS_BACK_BUTTON" desc="Label for the back button">
|
||||
Back
|
||||
</message>
|
||||
<message name="IDS_BRAVE_NEWS_DISCOVER_TITLE" desc="Title for the discover section in News settings">
|
||||
Discover
|
||||
</message>
|
||||
<message name="IDS_BRAVE_NEWS_SEARCH_PLACEHOLDER_LABEL" desc="Label that displays in the searchbox when the user hasn't entered anything">
|
||||
Search for site, topic, or RSS feed
|
||||
</message>
|
||||
|
||||
@@ -185,6 +185,7 @@ leo_icons = [
|
||||
"social-leo-favicon-fullheight-color.svg",
|
||||
"bluetooth-off.svg",
|
||||
"bluetooth.svg",
|
||||
"brave-icon-monochrome.svg",
|
||||
"brave-icon-outline.svg",
|
||||
"brave-icon-release-color.svg",
|
||||
"brave-icon-search-color.svg",
|
||||
|
||||
Reference in New Issue
Block a user