add migration for transcription.language to general.language
This commit is contained in:
@@ -6,7 +6,6 @@ import (
|
||||
|
||||
"github.com/charmbracelet/huh"
|
||||
"github.com/leonardotrapani/hyprvoice/internal/config"
|
||||
"github.com/leonardotrapani/hyprvoice/internal/language"
|
||||
)
|
||||
|
||||
// formatProvidersLabel formats the providers menu option
|
||||
@@ -14,14 +13,9 @@ func formatProvidersLabel(cfg *config.Config) string {
|
||||
return "Providers"
|
||||
}
|
||||
|
||||
// formatLanguageMenuLabel formats the language menu option showing current setting
|
||||
// formatLanguageMenuLabel formats the language menu option
|
||||
func formatLanguageMenuLabel(cfg *config.Config) string {
|
||||
langCode := cfg.General.Language
|
||||
if langCode == "" {
|
||||
return "Language (Auto-detect)"
|
||||
}
|
||||
lang := language.FromCode(langCode)
|
||||
return fmt.Sprintf("Language (%s)", lang.Name)
|
||||
return "Language"
|
||||
}
|
||||
|
||||
// formatTranscriptionLabel formats the transcription menu option
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
// editLanguage allows the user to select the global transcription language
|
||||
func editLanguage(cfg *config.Config) error {
|
||||
// no model-specific warnings for global language selection
|
||||
languageOptions := getLanguageOptions(nil)
|
||||
languageOptions := getLanguageOptions(nil, cfg.General.Language)
|
||||
|
||||
selectedLanguage := cfg.General.Language
|
||||
|
||||
|
||||
@@ -10,16 +10,26 @@ import (
|
||||
|
||||
// getLanguageOptions returns language options for the dropdown
|
||||
// if currentModel is provided, languages unsupported by that model will be marked
|
||||
func getLanguageOptions(currentModel *provider.Model) []huh.Option[string] {
|
||||
// currentLang is the currently selected language code (empty string for auto-detect)
|
||||
func getLanguageOptions(currentModel *provider.Model, currentLang string) []huh.Option[string] {
|
||||
var options []huh.Option[string]
|
||||
|
||||
// auto-detect is always first and recommended
|
||||
options = append(options, huh.NewOption("Auto-detect (Recommended)", ""))
|
||||
// auto-detect is always first
|
||||
autoLabel := "Auto-detect"
|
||||
if currentLang == "" {
|
||||
autoLabel += " (current)"
|
||||
}
|
||||
options = append(options, huh.NewOption(autoLabel, ""))
|
||||
|
||||
// add all languages
|
||||
for _, lang := range language.List() {
|
||||
label := formatLanguageLabel(lang)
|
||||
|
||||
// mark current selection
|
||||
if lang.Code == currentLang {
|
||||
label += " (current)"
|
||||
}
|
||||
|
||||
// add warning if model doesn't support this language
|
||||
if currentModel != nil && !currentModel.SupportsLanguage(lang.Code) {
|
||||
label += " (not supported by current model)"
|
||||
|
||||
Reference in New Issue
Block a user