- Updated silent.go to replace hardcoded strings with i18n keys for user feedback. - Enhanced telegraph.go to use i18n for error messages and prompts. - Modified update.go to implement i18n for version update notifications and errors. - Refactored dir.go to utilize i18n for help messages related to directory operations. - Updated parse.go to replace static text with i18n keys for parsed text entities. - Enhanced rule.go to use i18n for rule management help messages. - Refactored storage.go to implement i18n for storage selection prompts. - Updated task.go to utilize i18n for task addition notifications. - Added new i18n keys in keys.go for various messages. - Updated Chinese localization in zh-Hans.yaml to reflect new i18n keys and messages.
39 lines
1.2 KiB
Go
39 lines
1.2 KiB
Go
package msgelem
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
|
|
"github.com/gotd/td/telegram/message/styling"
|
|
"github.com/krau/SaveAny-Bot/common/i18n"
|
|
"github.com/krau/SaveAny-Bot/common/i18n/i18nk"
|
|
"github.com/krau/SaveAny-Bot/database"
|
|
)
|
|
|
|
func BuildDirHelpStyling(dirs []database.Dir) []styling.StyledTextOption {
|
|
return []styling.StyledTextOption{
|
|
styling.Bold(i18n.T(i18nk.BotMsgDirHelpUsage, nil)),
|
|
styling.Plain(i18n.T(i18nk.BotMsgDirHelpAvailableOps, nil)),
|
|
styling.Code("add"),
|
|
styling.Plain(i18n.T(i18nk.BotMsgDirHelpAddSuffix, nil)),
|
|
styling.Code("del"),
|
|
styling.Plain(i18n.T(i18nk.BotMsgDirHelpDelSuffix, nil)),
|
|
styling.Plain(i18n.T(i18nk.BotMsgDirHelpAddExamplePrefix, nil)),
|
|
styling.Code(i18n.T(i18nk.BotMsgDirHelpAddExampleCmd, nil)),
|
|
styling.Plain(i18n.T(i18nk.BotMsgDirHelpDelExamplePrefix, nil)),
|
|
styling.Code(i18n.T(i18nk.BotMsgDirHelpDelExampleCmd, nil)),
|
|
styling.Plain(i18n.T(i18nk.BotMsgDirHelpExistingDirsPrefix, nil)),
|
|
styling.Blockquote(func() string {
|
|
var sb strings.Builder
|
|
for _, dir := range dirs {
|
|
sb.WriteString(fmt.Sprintf("%d: ", dir.ID))
|
|
sb.WriteString(dir.StorageName)
|
|
sb.WriteString(" - ")
|
|
sb.WriteString(dir.Path)
|
|
sb.WriteString("\n")
|
|
}
|
|
return sb.String()
|
|
}(), true),
|
|
}
|
|
}
|