@@ -12,8 +12,6 @@ import {
1212import { logger } from "../../utils/logger" ;
1313import type { LingoDevState } from "../../widget/types" ;
1414import { fetchTranslations } from "./utils" ;
15- import type { CookieConfig } from "../../types" ;
16- import { defaultCookieConfig } from "../../utils/cookies" ;
1715import { serverUrl } from "@lingo.dev/compiler/dev-config" ;
1816import {
1917 getClientLocale ,
@@ -90,16 +88,6 @@ export interface TranslationProviderProps {
9088 */
9189 initialTranslations ?: Record < string , string > ;
9290
93- /**
94- * Debounce delay for batching translation requests (ms)
95- * Default: 100ms
96- */
97- batchDelay ?: number ;
98- /**
99- * Cookie configuration for persisting locale
100- */
101- cookieConfig ?: CookieConfig ;
102-
10391 /**
10492 * Optional router instance for Next.js integration
10593 * If provided, calls router.refresh() after locale change
@@ -128,6 +116,7 @@ export interface TranslationProviderProps {
128116}
129117
130118const IS_DEV = process . env . NODE_ENV === "development" ;
119+ const BATCH_DELAY = 200 ;
131120
132121/**
133122 * Translation Provider Component
@@ -162,11 +151,9 @@ function TranslationProvider__Prod({
162151 initialLocale,
163152 sourceLocale = "en" ,
164153 initialTranslations = { } ,
165- cookieConfig : customCookieConfig ,
166154 router,
167155 children,
168156} : TranslationProviderProps ) {
169- const [ cookieConfig ] = useState ( customCookieConfig || defaultCookieConfig ) ;
170157 // Use client locale detection if no initialLocale provided
171158 const [ locale , setLocaleState ] = useState ( ( ) => {
172159 if ( initialLocale ) return initialLocale ;
@@ -270,7 +257,7 @@ function TranslationProvider__Prod({
270257 await loadTranslations ( newLocale ) ;
271258 }
272259 } ,
273- [ cookieConfig , router , loadTranslations ] ,
260+ [ router , loadTranslations ] ,
274261 ) ;
275262
276263 return (
@@ -293,13 +280,10 @@ function TranslationProvider__Dev({
293280 initialLocale,
294281 sourceLocale = "en" ,
295282 initialTranslations = { } ,
296- batchDelay = 100 ,
297- cookieConfig : customCookieConfig ,
298283 router,
299284 devWidget,
300285 children,
301286} : TranslationProviderProps ) {
302- const [ cookieConfig ] = useState ( customCookieConfig || defaultCookieConfig ) ;
303287 // Use client locale detection if no initialLocale provided
304288 const [ locale , setLocaleState ] = useState ( ( ) => {
305289 if ( initialLocale ) {
@@ -441,8 +425,8 @@ function TranslationProvider__Dev({
441425 } finally {
442426 setIsLoading ( false ) ;
443427 }
444- } , batchDelay ) ;
445- } , [ allSeenHashes , locale , sourceLocale , batchDelay , translations ] ) ;
428+ } , BATCH_DELAY ) ;
429+ } , [ allSeenHashes , locale , sourceLocale , translations ] ) ;
446430
447431 /**
448432 * Clear batch timer on unmount
@@ -504,7 +488,7 @@ function TranslationProvider__Dev({
504488 setIsLoading ( false ) ;
505489 }
506490 } ,
507- [ cookieConfig , router ] ,
491+ [ router ] ,
508492 ) ;
509493
510494 // Load widget on client-side only (avoids SSR issues with HTMLElement)
0 commit comments