22 * Internationalization configuration for SUSE AI Extension
33 * Following Rancher UI patterns for consistent i18n implementation
44 */
5- import logger from '../utils/logger' ;
65
76export interface TranslationKey {
87 [ key : string ] : string | TranslationKey ;
@@ -225,11 +224,11 @@ export const translations: Translations = {
225224 * Get translated string by key
226225 * Supports nested keys with dot notation (e.g., 'suseai.apps.title')
227226 */
228- export function t ( key : string , params ?: Record < string , unknown > , locale : string = DEFAULT_LOCALE ) : string {
227+ export function t ( key : string , params ?: Record < string , any > , locale : string = DEFAULT_LOCALE ) : string {
229228 const translation = getNestedValue ( translations [ locale ] || translations [ DEFAULT_LOCALE ] , key ) ;
230229
231230 if ( typeof translation !== 'string' ) {
232- logger . warn ( `Translation key not found: ${ key } ` ) ;
231+ console . warn ( `Translation key not found: ${ key } ` ) ;
233232 return key ;
234233 }
235234
@@ -246,12 +245,9 @@ export function t(key: string, params?: Record<string, unknown>, locale: string
246245/**
247246 * Get nested value from object using dot notation
248247 */
249- function getNestedValue ( obj : unknown , path : string ) : unknown {
250- return path . split ( '.' ) . reduce ( ( current : unknown , key : string ) => {
251- if ( current && typeof current === 'object' ) {
252- return ( current as Record < string , unknown > ) [ key ] ;
253- }
254- return undefined ;
248+ function getNestedValue ( obj : any , path : string ) : any {
249+ return path . split ( '.' ) . reduce ( ( current , key ) => {
250+ return current && current [ key ] !== undefined ? current [ key ] : undefined ;
255251 } , obj ) ;
256252}
257253
@@ -274,5 +270,5 @@ export function getAvailableLocales(): readonly string[] {
274270 * Validate locale
275271 */
276272export function isValidLocale ( locale : string ) : boolean {
277- return ( AVAILABLE_LOCALES as readonly string [ ] ) . includes ( locale ) ;
273+ return AVAILABLE_LOCALES . includes ( locale as any ) ;
278274}
0 commit comments