improvement: Localize Select a file phrase when picking a file

This commit is contained in:
Artem Chepurnyi 2024-04-23 21:33:50 +03:00
parent f3b0b521d0
commit 6e964c96e1
1 changed files with 6 additions and 1 deletions

View File

@ -6,7 +6,10 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberUpdatedState
import com.artemchep.keyguard.common.usecase.ShowMessage
import com.artemchep.keyguard.desktop.util.showFilePicker
import com.artemchep.keyguard.feature.localization.textResource
import com.artemchep.keyguard.platform.LocalLeContext
import com.artemchep.keyguard.platform.leParseUri
import com.artemchep.keyguard.res.Res
import com.artemchep.keyguard.ui.CollectedEffect
import com.artemchep.keyguard.ui.LocalComposeWindow
import kotlinx.coroutines.flow.Flow
@ -23,6 +26,7 @@ actual fun FilePickerEffect(
}
val composeWindow by rememberUpdatedState(LocalComposeWindow.current)
val context by rememberUpdatedState(LocalLeContext)
val showMessage: ShowMessage by rememberInstance()
CollectedEffect(flow) { intent ->
@ -41,9 +45,10 @@ actual fun FilePickerEffect(
}
}
val filters = if (extensions.isNotEmpty()) {
val title = textResource(Res.strings.select_file, context)
listOf(
FileDialog.Filter(
title = "Select a file",
title = title,
extensions = extensions,
),
)