[AI Chat] [Content Agent] NTP strings setup (#32265)

* [AI Chat] [Content Agent] NTP strings setup
This commit is contained in:
Pete Miller
2025-11-11 20:40:34 -08:00
committed by GitHub
parent e06add899e
commit 44a6b69ad1
8 changed files with 37 additions and 2 deletions
@@ -3,4 +3,7 @@
// 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/.
console.log('ai_chat_agent_new_tab_page')
import './strings'
import { getLocale } from '$web-common/locale'
console.log('ai_chat_agent_new_tab_page', getLocale(S.AI_AGENT_NTP_TITLE))
@@ -0,0 +1,15 @@
// Copyright (c) 2025 The Brave Authors. All rights reserved.
// This Source Code Form is subject to the terms of the Mozilla Public
// 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 '$web-common/strings'
import { AiChatAgentNtpStrings } from 'gen/components/grit/brave_components_webui_strings'
declare global {
// Expose the AiChatStrings enum on the global `S` enum.
interface Strings {
AiChatAgentNtpStrings: typeof AiChatAgentNtpStrings
}
}
@@ -0,0 +1,4 @@
{
"extends": "../../../tsconfig",
"include": ["**/*.ts", "**/*.tsx", "**/*.d.ts", "../../../definitions/*.d.ts"]
}
@@ -10,6 +10,7 @@
#include "brave/browser/ui/webui/brave_webui_source.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/webui_url_constants.h"
#include "components/grit/brave_components_webui_strings.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
#include "ui/webui/webui_util.h"
@@ -24,6 +25,8 @@ AIChatAgentNewTabPageUI::AIChatAgentNewTabPageUI(content::WebUI* web_ui)
source, kAiChatAgentNewTabPageGenerated,
IDR_AI_CHAT_AGENT_NEW_TAB_PAGE_STATIC_AI_CHAT_AGENT_NEW_TAB_PAGE_HTML);
source->AddLocalizedStrings(webui::kAiChatAgentNtpStrings);
AddBackgroundColorToSource(source, web_ui->GetWebContents());
}
@@ -8,7 +8,7 @@ import '$web-common/strings'
import { AiChatStrings } from 'gen/components/grit/brave_components_webui_strings'
declare global {
// Expose the AiChatStrings enum on the global `S` enum.
// Expose the feature's enum set on the global `S` enum
interface Strings {
AiChatStrings: typeof AiChatStrings
}
+1
View File
@@ -165,6 +165,7 @@ brave_grit("strings") {
defines = [
"enable_ai_chat=$enable_ai_chat",
"enable_brave_ai_chat_agent_profile=$enable_brave_ai_chat_agent_profile",
"enable_speedreader=$enable_speedreader",
"enable_tor=$enable_tor",
"enable_brave_vpn=$enable_brave_vpn",
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<grit-part>
<message name="IDS_AI_AGENT_NTP_TITLE" desc="Title for the Brave AI Agent mode New Tab Page" formatter_data="webui=AiChatAgentNtp">
Agent mode
</message>
</grit-part>
@@ -830,6 +830,9 @@
<part file="speedreader_strings.grdp" />
<part file="ai_chat_prompts.grdp" />
<part file="ai_chat_ui_strings.grdp" />
<if expr="enable_brave_ai_chat_agent_profile">
<part file="ai_chat_agent_ntp_strings.grdp" />
</if>
<part file="email_aliases_strings.grdp" />
<if expr="not is_android">
<part file="brave_new_tab_page_strings.grdp" />