Skip to content

Commit 784f784

Browse files
committed
WLMAI-1653 - External Gen Ai support internalization for Prod
1 parent 36aba3c commit 784f784

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

AI/GenAI-ChatBot-application-sample/src/app/[locale]/layout.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ import RedirectProvider from "./providers/redirectProvider";
1111
import GenAiClerkProvider from "./providers/genAiClerkProvider";
1212
import initTranslations from "../i18n";
1313
import TranslationsProvider from "./components/translationsProvider";
14-
import { SupportedLocales } from "@/lib/store.types";
1514

16-
const lang = process.env.NEXT_PUBLIC_LANGUAGE as SupportedLocales;
15+
const lang = process.env.NEXT_PUBLIC_LANGUAGE;
1716

1817
export const metadata: Metadata = {
1918
title: "NetApp GenAI Studio",

AI/GenAI-ChatBot-application-sample/src/lib/api/chatApi.slice.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { apiSlice, BASE_URL } from "./api.slice";
33
import { History, Message } from "./api.types";
44
import { setMessage } from "../slices/chat.slice";
55
import { AiChatState } from "../store.types";
6+
import initTranslations from "@/app/i18n";
67

78
interface ChatParams {
89
knowledgeBaseId: string
@@ -71,10 +72,13 @@ const getSocket = async (args: { chatId: string, knowledgeBaseId: string, access
7172
});
7273
}
7374

74-
const dispatchErrorMessage = () => {
75+
const dispatchErrorMessage = async () => {
76+
const lang = process.env.NEXT_PUBLIC_LANGUAGE;
77+
const { t } = await initTranslations(lang, ['genAi']);
78+
7579
dispatch(setMessage({
7680
question,
77-
answer: 'We encountered an error. Wait a few minutes and then try again.',
81+
answer: t('genAI.messages.errors.generalError'),
7882
stopReason: TEMP_STOP_REASON,
7983
type: 'ERROR',
8084
chatId

AI/GenAI-ChatBot-application-sample/src/lib/store.types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { KnowledgeBase } from "./api/api.types";
77
import errorHandelingSlice from "./slices/errorHandeling.slice";
88

99
export type MessageType = 'ANSWER' | 'ERROR';
10-
export type SupportedLocales = 'en' | 'jp';
1110

1211
export interface AiChatState {
1312
[authSlice.name]: Auth,

0 commit comments

Comments
 (0)