@@ -74,6 +74,8 @@ class TextExplorerUI(
7474
7575 @Composable
7676 private fun content () {
77+ val locale = LocalI18n .current
78+
7779 var textField by remember { mutableStateOf(TextFieldValue (" " )) }
7880 var selectedRows by remember { mutableStateOf(listOf<Map <String , String >>()) }
7981 var openWindow by remember { mutableStateOf(Window .NONE ) }
@@ -96,7 +98,7 @@ class TextExplorerUI(
9698 var selectedText = remember(this .poolSelected) {
9799 val (pool, field) = dataService.getSelectedPool().split(" ." , limit = 2 )
98100
99- if (pool == " null" ) " No source available "
101+ if (pool == " null" ) locale[ " main.no_source " ]
100102 else " $pool ($field )"
101103 }
102104
@@ -176,15 +178,15 @@ class TextExplorerUI(
176178 }
177179 }
178180
179- DropDownMenu (
181+ IconDropDown (
180182 modifier = Modifier .align(Alignment .TopEnd ),
181- items = listOf (" Load Plugin " , " Load Data " , " Plugin Info " , " ---" , " Settings " ),
183+ items = listOf (" setting.load_plugin " , " setting.load_data " , " plugin.title " , " ---" , " settings.title " ),
182184 ) {
183185 when (it) {
184- " Load Plugin " -> openWindow = Window .LOAD_PLUGIN
185- " Load Data " -> openWindow = Window .LOAD_DATA
186- " Settings " -> openWindow = Window .SETTINGS
187- " Plugin Info " -> openWindow = Window .PLUGIN_INFO
186+ " setting.load_plugin " -> openWindow = Window .LOAD_PLUGIN
187+ " setting.load_data " -> openWindow = Window .LOAD_DATA
188+ " plugin.title " -> openWindow = Window .PLUGIN_INFO
189+ " settings.title " -> openWindow = Window .SETTINGS
188190 }
189191 }
190192
@@ -222,7 +224,7 @@ class TextExplorerUI(
222224 showSuggestions = false
223225 }
224226 },
225- placeholder = { Text (" Search... " ) },
227+ placeholder = { Text (locale[ " main.search.placeholder " ] ) },
226228 modifier = Modifier
227229 .width(600 .dp)
228230 .background(
@@ -289,7 +291,7 @@ class TextExplorerUI(
289291 showSuggestions = false
290292 showTable = false
291293 }) {
292- Icon (Icons .Default .Close , contentDescription = " Close " )
294+ Icon (Icons .Default .Close , contentDescription = locale[ " main.icon.close " ] )
293295 }
294296 }
295297 )
@@ -323,7 +325,7 @@ class TextExplorerUI(
323325 modifier = Modifier .height(70 .dp).padding(horizontal = 10 .dp),
324326 enabled = textField.text.isNotBlank() && dataService.hasSelectedPool()
325327 ) {
326- Icon (Icons .Default .Search , contentDescription = " Search " )
328+ Icon (Icons .Default .Search , contentDescription = locale[ " main.icon.search " ] )
327329 }
328330 }
329331
@@ -335,7 +337,7 @@ class TextExplorerUI(
335337 ) inner@{
336338 if (totalPages == 0L ) {
337339 Text (
338- " No results were found. " ,
340+ locale[ " main.no_results " ] ,
339341 fontSize = 24 .sp,
340342 modifier = Modifier .align(Alignment .CenterHorizontally ).padding(16 .dp)
341343 )
@@ -395,7 +397,7 @@ class TextExplorerUI(
395397 )
396398
397399 if (totalPages < 2 ) {
398- Text (" Total: $ amount" , modifier = Modifier .align(Alignment .CenterHorizontally ))
400+ Text (locale[ " main.total " , amount] , modifier = Modifier .align(Alignment .CenterHorizontally ))
399401 return @inner
400402 }
401403
@@ -420,10 +422,10 @@ class TextExplorerUI(
420422 }
421423 }, enabled = currentPage > 0
422424 ) {
423- Icon (Icons .AutoMirrored .Filled .KeyboardArrowLeft , contentDescription = " Left " )
425+ Icon (Icons .AutoMirrored .Filled .KeyboardArrowLeft , contentDescription = locale[ " main.nav.left " ] )
424426 }
425427
426- Text (" Page ${ currentPage + 1 } of $ totalPages (Total: $ amount) " )
428+ Text (locale[ " main.page_info " , currentPage + 1 , totalPages, amount] )
427429
428430 IconButton (
429431 onClick = {
@@ -439,7 +441,7 @@ class TextExplorerUI(
439441 }
440442 }, enabled = currentPage < totalPages - 1
441443 ) {
442- Icon (Icons .AutoMirrored .Filled .KeyboardArrowRight , contentDescription = " Right " )
444+ Icon (Icons .AutoMirrored .Filled .KeyboardArrowRight , contentDescription = locale[ " main.nav.right " ] )
443445 }
444446 }
445447 }
@@ -480,8 +482,8 @@ class TextExplorerUI(
480482 ) {
481483 Icon (
482484 imageVector = Icons .Filled .CheckCircle ,
483- contentDescription = " Success " ,
484- tint = Color ( 0xFF388E3C ),
485+ contentDescription = locale[ " main.status.success " ] ,
486+ tint = App . Colors . GREEN_HIGHLIGHT .toComposeColor( ),
485487 modifier = Modifier .size(24 .dp)
486488 )
487489
@@ -506,14 +508,14 @@ class TextExplorerUI(
506508 ) {
507509 Icon (
508510 imageVector = Icons .Filled .Warning ,
509- contentDescription = " Error " ,
511+ contentDescription = locale[ " main.status.error " ] ,
510512 tint = Color (0xFFD32F2F ),
511513 modifier = Modifier .size(24 .dp)
512514 )
513515
514516 Text (
515517 text = (loadState as LoadState .Error ).message,
516- color = Color ( 0xFFD32F2F )
518+ color = App . Colors . RED_HIGHLIGHT .toComposeColor( )
517519 )
518520 }
519521 LaunchedEffect (loadState) {
@@ -550,12 +552,12 @@ class TextExplorerUI(
550552 if (dataInfo == null ) return @DataLoaderWindow
551553
552554 scope.launch {
553- loadState = LoadState .Loading (" Loading data pool " )
555+ loadState = LoadState .Loading (locale[ " main.loading " ] )
554556
555557 val poolsEmpty = dataService.getAvailablePools().isEmpty()
556558
557559 val success = dataService.createDataPool(dataInfo, dataDir) { progress ->
558- loadState = LoadState .Loading (" Loading data pool ( $ progress %) " )
560+ loadState = LoadState .Loading (locale[ " main.loading_progress " , progress] )
559561 }
560562
561563 loadState = if (success) {
@@ -566,8 +568,8 @@ class TextExplorerUI(
566568 poolSelected = ! poolSelected
567569 }
568570
569- LoadState .Success (" Successfully loaded data pool ' ${ dataInfo.name} ' " )
570- } else LoadState .Error (" Failed to create data pool " )
571+ LoadState .Success (locale[ " main.success_load " , dataInfo.name] )
572+ } else LoadState .Error (locale[ " main.error_load " ] )
571573 }
572574 }
573575
0 commit comments