mirror of https://github.com/Wox-launcher/Wox
Improve i18n for system plugins
This commit is contained in:
parent
188d16a39d
commit
e6df3c3a7b
|
@ -64,6 +64,9 @@ func (a *APIImpl) ShowApp(ctx context.Context) {
|
|||
}
|
||||
|
||||
func (a *APIImpl) Notify(ctx context.Context, message string) {
|
||||
// translate message
|
||||
message = a.GetTranslation(ctx, message)
|
||||
|
||||
if GetPluginManager().GetUI().IsPluginQuery(ctx, a.pluginInstance.Metadata.Id) {
|
||||
GetPluginManager().GetUI().ShowToolbarMsg(ctx, share.ToolbarMsg{
|
||||
Text: message,
|
||||
|
|
|
@ -4,6 +4,7 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"sort"
|
||||
"wox/i18n"
|
||||
"wox/updater"
|
||||
"wox/util"
|
||||
"wox/util/permission"
|
||||
|
@ -40,9 +41,9 @@ func checkWoxVersion(ctx context.Context) DoctorCheckResult {
|
|||
if err != nil {
|
||||
if latestVersion.LatestVersion == updater.CURRENT_VERSION {
|
||||
return DoctorCheckResult{
|
||||
Name: "Version",
|
||||
Name: "i18n:plugin_doctor_version",
|
||||
Status: true,
|
||||
Description: "Already using the latest version",
|
||||
Description: fmt.Sprintf(i18n.GetI18nManager().TranslateWox(ctx, "plugin_doctor_version_latest"), latestVersion.LatestVersion),
|
||||
ActionName: "",
|
||||
Action: func(ctx context.Context) {
|
||||
},
|
||||
|
@ -50,7 +51,7 @@ func checkWoxVersion(ctx context.Context) DoctorCheckResult {
|
|||
}
|
||||
|
||||
return DoctorCheckResult{
|
||||
Name: "Version",
|
||||
Name: "i18n:plugin_doctor_version",
|
||||
Status: true,
|
||||
Description: err.Error(),
|
||||
ActionName: "",
|
||||
|
@ -60,12 +61,12 @@ func checkWoxVersion(ctx context.Context) DoctorCheckResult {
|
|||
}
|
||||
|
||||
return DoctorCheckResult{
|
||||
Name: "Version",
|
||||
Name: "i18n:plugin_doctor_version",
|
||||
Status: false,
|
||||
Description: fmt.Sprintf("New version available: %s", latestVersion),
|
||||
ActionName: "Check for updates",
|
||||
Description: fmt.Sprintf(i18n.GetI18nManager().TranslateWox(ctx, "plugin_doctor_version_update_available"), latestVersion.CurrentVersion, latestVersion.LatestVersion),
|
||||
ActionName: "i18n:plugin_doctor_version_download",
|
||||
Action: func(ctx context.Context) {
|
||||
//updater.OpenUpdatePage(ctx)
|
||||
util.ShellOpen(latestVersion.DownloadUrl)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -74,10 +75,10 @@ func checkAccessibilityPermission(ctx context.Context) DoctorCheckResult {
|
|||
hasPermission := permission.HasAccessibilityPermission(ctx)
|
||||
if !hasPermission {
|
||||
return DoctorCheckResult{
|
||||
Name: "Accessibility",
|
||||
Name: "i18n:plugin_doctor_accessibility",
|
||||
Status: false,
|
||||
Description: "You need to grant Wox Accessibility permission to use this plugin",
|
||||
ActionName: "Open Accessibility Settings",
|
||||
Description: "i18n:plugin_doctor_accessibility_required",
|
||||
ActionName: "i18n:plugin_doctor_accessibility_open_settings",
|
||||
Action: func(ctx context.Context) {
|
||||
permission.GrantAccessibilityPermission(ctx)
|
||||
},
|
||||
|
@ -85,9 +86,9 @@ func checkAccessibilityPermission(ctx context.Context) DoctorCheckResult {
|
|||
}
|
||||
|
||||
return DoctorCheckResult{
|
||||
Name: "Accessibility",
|
||||
Name: "i18n:plugin_doctor_accessibility",
|
||||
Status: hasPermission,
|
||||
Description: "You have granted Wox Accessibility permission",
|
||||
Description: "i18n:plugin_doctor_accessibility_granted",
|
||||
ActionName: "",
|
||||
Action: func(ctx context.Context) {
|
||||
},
|
||||
|
|
|
@ -529,6 +529,10 @@ func (m *Manager) PolishResult(ctx context.Context, pluginInstance *Instance, qu
|
|||
for actionIndex := range result.Actions {
|
||||
result.Actions[actionIndex].Name = m.translatePlugin(ctx, pluginInstance, result.Actions[actionIndex].Name)
|
||||
}
|
||||
// translate preview data if preview type is text
|
||||
if result.Preview.PreviewType == WoxPreviewTypeText {
|
||||
result.Preview.PreviewData = m.translatePlugin(ctx, pluginInstance, result.Preview.PreviewData)
|
||||
}
|
||||
|
||||
// set first action as default if no default action is set
|
||||
defaultActionCount := lo.CountBy(result.Actions, func(item QueryResultAction) bool {
|
||||
|
|
|
@ -7,6 +7,7 @@ import (
|
|||
"image"
|
||||
"strings"
|
||||
"wox/ai"
|
||||
"wox/i18n"
|
||||
"wox/plugin"
|
||||
"wox/setting/definition"
|
||||
"wox/share"
|
||||
|
@ -54,7 +55,7 @@ func (c *Plugin) GetMetadata() plugin.Metadata {
|
|||
Version: "1.0.0",
|
||||
MinWoxVersion: "2.0.0",
|
||||
Runtime: "Go",
|
||||
Description: "Make your daily tasks easier with AI commands",
|
||||
Description: "i18n:plugin_ai_command_description",
|
||||
Icon: aiCommandIcon.String(),
|
||||
Entry: "",
|
||||
TriggerKeywords: []string{
|
||||
|
@ -70,43 +71,43 @@ func (c *Plugin) GetMetadata() plugin.Metadata {
|
|||
Type: definition.PluginSettingDefinitionTypeTable,
|
||||
Value: &definition.PluginSettingValueTable{
|
||||
Key: "commands",
|
||||
Title: "Commands",
|
||||
Tooltip: "The commands to run.\r\nE.g. `translate`, user will type `ai translate` to run translate based on the prompt",
|
||||
Title: "i18n:plugin_ai_command_commands",
|
||||
Tooltip: "i18n:plugin_ai_command_commands_tooltip",
|
||||
Columns: []definition.PluginSettingValueTableColumn{
|
||||
{
|
||||
Key: "name",
|
||||
Label: "Name",
|
||||
Label: "i18n:plugin_ai_command_name",
|
||||
Type: definition.PluginSettingValueTableColumnTypeText,
|
||||
Width: 100,
|
||||
Tooltip: "The name of the ai command. E.g. `Translator`",
|
||||
Tooltip: "i18n:plugin_ai_command_name_tooltip",
|
||||
},
|
||||
{
|
||||
Key: "command",
|
||||
Label: "Command",
|
||||
Label: "i18n:plugin_ai_command_command",
|
||||
Type: definition.PluginSettingValueTableColumnTypeText,
|
||||
Width: 80,
|
||||
Tooltip: "The command to run. E.g. `translate`, user will type `ai translate` to run this command",
|
||||
Tooltip: "i18n:plugin_ai_command_command_tooltip",
|
||||
},
|
||||
{
|
||||
Key: "model",
|
||||
Label: "Model",
|
||||
Label: "i18n:plugin_ai_command_model",
|
||||
Type: definition.PluginSettingValueTableColumnTypeSelectAIModel,
|
||||
Width: 100,
|
||||
Tooltip: "The ai model to use.",
|
||||
Tooltip: "i18n:plugin_ai_command_model_tooltip",
|
||||
},
|
||||
{
|
||||
Key: "prompt",
|
||||
Label: "Prompt",
|
||||
Label: "i18n:plugin_ai_command_prompt",
|
||||
Type: definition.PluginSettingValueTableColumnTypeText,
|
||||
TextMaxLines: 10,
|
||||
Tooltip: "The prompt to send to the ai. %s will be replaced with the user input",
|
||||
Tooltip: "i18n:plugin_ai_command_prompt_tooltip",
|
||||
},
|
||||
{
|
||||
Key: "vision",
|
||||
Label: "Vision",
|
||||
Label: "i18n:plugin_ai_command_vision",
|
||||
Type: definition.PluginSettingValueTableColumnTypeCheckbox,
|
||||
Width: 60,
|
||||
Tooltip: "Does the command interact with vision?",
|
||||
Tooltip: "i18n:plugin_ai_command_vision_tooltip",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -179,8 +180,8 @@ func (c *Plugin) querySelection(ctx context.Context, query plugin.Query) []plugi
|
|||
|
||||
var startAnsweringTime int64
|
||||
onPreparing := func(current plugin.RefreshableResult) plugin.RefreshableResult {
|
||||
current.Preview.PreviewData = "Answering..."
|
||||
current.SubTitle = "Answering..."
|
||||
current.Preview.PreviewData = "i18n:plugin_ai_command_answering"
|
||||
current.SubTitle = "i18n:plugin_ai_command_answering"
|
||||
startAnsweringTime = util.GetSystemTimestamp()
|
||||
return current
|
||||
}
|
||||
|
@ -199,12 +200,12 @@ func (c *Plugin) querySelection(ctx context.Context, query plugin.Query) []plugi
|
|||
|
||||
if isFinished {
|
||||
current.RefreshInterval = 0 // stop refreshing
|
||||
current.SubTitle = fmt.Sprintf("Answered, cost %d ms", util.GetSystemTimestamp()-startAnsweringTime)
|
||||
current.SubTitle = fmt.Sprintf(i18n.GetI18nManager().TranslateWox(ctx, "plugin_ai_command_answered_cost"), util.GetSystemTimestamp()-startAnsweringTime)
|
||||
answerText = current.Preview.PreviewData
|
||||
|
||||
current.Actions = []plugin.QueryResultAction{
|
||||
{
|
||||
Name: "Copy",
|
||||
Name: "i18n:plugin_ai_command_copy",
|
||||
Action: func(ctx context.Context, actionContext plugin.ActionContext) {
|
||||
clipboard.WriteText(answerText)
|
||||
},
|
||||
|
@ -255,14 +256,14 @@ func (c *Plugin) querySelection(ctx context.Context, query plugin.Query) []plugi
|
|||
Title: command.Name,
|
||||
SubTitle: fmt.Sprintf("%s - %s", command.AIModel().Provider, command.AIModel().Name),
|
||||
Icon: aiCommandIcon,
|
||||
Preview: plugin.WoxPreview{PreviewType: plugin.WoxPreviewTypeText, PreviewData: "Enter to start chat"},
|
||||
Preview: plugin.WoxPreview{PreviewType: plugin.WoxPreviewTypeText, PreviewData: "i18n:plugin_ai_command_enter_to_start"},
|
||||
RefreshInterval: 100,
|
||||
OnRefresh: createLLMOnRefreshHandler(ctx, c.api.AIChatStream, command.AIModel(), conversations, func() bool {
|
||||
return startGenerate
|
||||
}, onPreparing, onAnswering, onAnswerErr),
|
||||
Actions: []plugin.QueryResultAction{
|
||||
{
|
||||
Name: "Run",
|
||||
Name: "i18n:plugin_ai_command_run",
|
||||
PreventHideAfterAction: true,
|
||||
Action: func(ctx context.Context, actionContext plugin.ActionContext) {
|
||||
startGenerate = true
|
||||
|
@ -289,7 +290,7 @@ func (c *Plugin) listAllCommands(ctx context.Context, query plugin.Query) []plug
|
|||
if len(commands) == 0 {
|
||||
return []plugin.QueryResult{
|
||||
{
|
||||
Title: "No ai commands found",
|
||||
Title: "i18n:plugin_ai_command_no_commands",
|
||||
Icon: aiCommandIcon,
|
||||
},
|
||||
}
|
||||
|
@ -303,7 +304,7 @@ func (c *Plugin) listAllCommands(ctx context.Context, query plugin.Query) []plug
|
|||
Icon: aiCommandIcon,
|
||||
Actions: []plugin.QueryResultAction{
|
||||
{
|
||||
Name: "Run",
|
||||
Name: "i18n:plugin_ai_command_run",
|
||||
PreventHideAfterAction: true,
|
||||
Action: func(ctx context.Context, actionContext plugin.ActionContext) {
|
||||
c.api.ChangeQuery(ctx, share.PlainQuery{
|
||||
|
@ -332,7 +333,7 @@ func (c *Plugin) queryCommand(ctx context.Context, query plugin.Query) []plugin.
|
|||
if query.Search == "" {
|
||||
return []plugin.QueryResult{
|
||||
{
|
||||
Title: "Type to start chat",
|
||||
Title: "i18n:plugin_ai_command_type_to_start",
|
||||
Icon: aiCommandIcon,
|
||||
},
|
||||
}
|
||||
|
@ -351,7 +352,7 @@ func (c *Plugin) queryCommand(ctx context.Context, query plugin.Query) []plugin.
|
|||
if len(commands) == 0 {
|
||||
return []plugin.QueryResult{
|
||||
{
|
||||
Title: "No ai commands found",
|
||||
Title: "i18n:plugin_ai_command_no_commands",
|
||||
Icon: aiCommandIcon,
|
||||
},
|
||||
}
|
||||
|
@ -363,7 +364,7 @@ func (c *Plugin) queryCommand(ctx context.Context, query plugin.Query) []plugin.
|
|||
if !commandExist {
|
||||
return []plugin.QueryResult{
|
||||
{
|
||||
Title: "No ai command found",
|
||||
Title: "i18n:plugin_ai_command_not_found",
|
||||
Icon: aiCommandIcon,
|
||||
},
|
||||
}
|
||||
|
@ -372,7 +373,7 @@ func (c *Plugin) queryCommand(ctx context.Context, query plugin.Query) []plugin.
|
|||
if aiCommandSetting.Prompt == "" {
|
||||
return []plugin.QueryResult{
|
||||
{
|
||||
Title: "Prompt is empty for this ai command",
|
||||
Title: "i18n:plugin_ai_command_empty_prompt",
|
||||
Icon: aiCommandIcon,
|
||||
},
|
||||
}
|
||||
|
@ -412,7 +413,7 @@ func (c *Plugin) queryCommand(ctx context.Context, query plugin.Query) []plugin.
|
|||
}
|
||||
|
||||
result := plugin.QueryResult{
|
||||
Title: fmt.Sprintf("Chat with %s", aiCommandSetting.Name),
|
||||
Title: fmt.Sprintf(i18n.GetI18nManager().TranslateWox(ctx, "plugin_ai_command_chat_with"), aiCommandSetting.Name),
|
||||
SubTitle: fmt.Sprintf("%s - %s", aiCommandSetting.AIModel().Provider, aiCommandSetting.AIModel().Name),
|
||||
Preview: plugin.WoxPreview{PreviewType: plugin.WoxPreviewTypeMarkdown, PreviewData: ""},
|
||||
Icon: aiCommandIcon,
|
||||
|
@ -422,7 +423,7 @@ func (c *Plugin) queryCommand(ctx context.Context, query plugin.Query) []plugin.
|
|||
}, nil, onAnswering, onAnswerErr),
|
||||
Actions: []plugin.QueryResultAction{
|
||||
{
|
||||
Name: "Copy",
|
||||
Name: "i18n:plugin_ai_command_copy",
|
||||
Icon: plugin.CopyIcon,
|
||||
Action: func(ctx context.Context, actionContext plugin.ActionContext) {
|
||||
clipboard.WriteText(actionContext.ContextData)
|
||||
|
|
|
@ -4,6 +4,7 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"slices"
|
||||
"wox/i18n"
|
||||
"wox/plugin"
|
||||
"wox/setting"
|
||||
"wox/util"
|
||||
|
@ -59,18 +60,18 @@ func (c *BackupPlugin) Query(ctx context.Context, query plugin.Query) []plugin.Q
|
|||
func (c *BackupPlugin) backup(ctx context.Context, query plugin.Query) []plugin.QueryResult {
|
||||
return []plugin.QueryResult{
|
||||
{
|
||||
Title: "Backup now",
|
||||
SubTitle: "Backup Wox settings",
|
||||
Title: "i18n:plugin_backup_now",
|
||||
SubTitle: "i18n:plugin_backup_subtitle",
|
||||
Icon: backupIcon,
|
||||
Actions: []plugin.QueryResultAction{
|
||||
{
|
||||
Name: "Backup",
|
||||
Name: "i18n:plugin_backup_action",
|
||||
Action: func(ctx context.Context, actionContext plugin.ActionContext) {
|
||||
backupErr := setting.GetSettingManager().Backup(ctx, setting.BackupTypeManual)
|
||||
if backupErr != nil {
|
||||
c.api.Notify(ctx, backupErr.Error())
|
||||
} else {
|
||||
c.api.Notify(ctx, "Wox settings backed up")
|
||||
c.api.Notify(ctx, i18n.GetI18nManager().TranslateWox(ctx, "plugin_backup_success"))
|
||||
}
|
||||
},
|
||||
},
|
||||
|
@ -84,7 +85,7 @@ func (c *BackupPlugin) restore(ctx context.Context, query plugin.Query) []plugin
|
|||
if err != nil {
|
||||
return []plugin.QueryResult{
|
||||
{
|
||||
Title: "Error",
|
||||
Title: "i18n:plugin_backup_error",
|
||||
SubTitle: err.Error(),
|
||||
Icon: backupIcon,
|
||||
},
|
||||
|
@ -104,13 +105,13 @@ func (c *BackupPlugin) restore(ctx context.Context, query plugin.Query) []plugin
|
|||
Icon: backupIcon,
|
||||
Actions: []plugin.QueryResultAction{
|
||||
{
|
||||
Name: "Restore",
|
||||
Name: "i18n:plugin_backup_restore",
|
||||
Action: func(ctx context.Context, actionContext plugin.ActionContext) {
|
||||
restoreErr := setting.GetSettingManager().Restore(ctx, backup.Id)
|
||||
if restoreErr != nil {
|
||||
c.api.Notify(ctx, restoreErr.Error())
|
||||
} else {
|
||||
c.api.Notify(ctx, "Wox settings restored")
|
||||
c.api.Notify(ctx, i18n.GetI18nManager().TranslateWox(ctx, "plugin_backup_restore_success"))
|
||||
}
|
||||
},
|
||||
},
|
||||
|
|
|
@ -8,6 +8,7 @@ import (
|
|||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
"wox/i18n"
|
||||
"wox/plugin"
|
||||
"wox/setting/definition"
|
||||
"wox/setting/validator"
|
||||
|
@ -84,8 +85,8 @@ func (c *BrowserPlugin) GetMetadata() plugin.Metadata {
|
|||
Value: &definition.PluginSettingValueTextBox{
|
||||
Key: browserWebsocketPortSettingKey,
|
||||
DefaultValue: "34988",
|
||||
Label: "Server Port",
|
||||
Tooltip: "The port for the websocket server to communicate with the browser extension. Default is 34988. ",
|
||||
Label: "i18n:plugin_browser_server_port",
|
||||
Tooltip: "i18n:plugin_browser_server_port_tooltip",
|
||||
Style: definition.PluginSettingValueStyle{
|
||||
PaddingRight: 10,
|
||||
},
|
||||
|
@ -109,7 +110,7 @@ func (c *BrowserPlugin) Init(ctx context.Context, initParams plugin.InitParams)
|
|||
util.Go(ctx, "newWebsocketServer on init", func() {
|
||||
err := c.newWebsocketServer(ctx)
|
||||
if err != nil {
|
||||
c.api.Notify(ctx, fmt.Sprintf("Failed to start websocket server: %s", err.Error()))
|
||||
c.api.Notify(ctx, fmt.Sprintf(i18n.GetI18nManager().TranslateWox(ctx, "plugin_browser_server_start_error"), err.Error()))
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -118,7 +119,7 @@ func (c *BrowserPlugin) Init(ctx context.Context, initParams plugin.InitParams)
|
|||
util.Go(ctx, "newWebsocketServer on port changed", func() {
|
||||
err := c.newWebsocketServer(ctx)
|
||||
if err != nil {
|
||||
c.api.Notify(ctx, fmt.Sprintf("Failed to start websocket server: %s", err.Error()))
|
||||
c.api.Notify(ctx, fmt.Sprintf(i18n.GetI18nManager().TranslateWox(ctx, "plugin_browser_server_start_error"), err.Error()))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -151,7 +152,7 @@ func (c *BrowserPlugin) Query(ctx context.Context, query plugin.Query) (results
|
|||
Icon: icon,
|
||||
Actions: []plugin.QueryResultAction{
|
||||
{
|
||||
Name: "Open",
|
||||
Name: "i18n:plugin_browser_open_tab",
|
||||
Action: func(ctx context.Context, actionContext plugin.ActionContext) {
|
||||
c.m.Broadcast([]byte(fmt.Sprintf(`{"method":"highlightTab","data":"{\"tabId\":%d,\"windowId\":%d,\"tabIndex\": %d}"}`, tab.TabId, tab.WindowId, tab.TabIndex)))
|
||||
},
|
||||
|
@ -229,7 +230,6 @@ func (c *BrowserPlugin) newWebsocketServer(ctx context.Context) error {
|
|||
})
|
||||
})
|
||||
|
||||
c.api.Log(ctx, plugin.LogLevelInfo, fmt.Sprintf("browser websocket server start at:ws://localhost:%d", port))
|
||||
c.server = &http.Server{Addr: fmt.Sprintf("localhost:%d", port), Handler: cors.Default().Handler(mux)}
|
||||
err := c.server.ListenAndServe()
|
||||
if err != nil && !errors.Is(err, http.ErrServerClosed) {
|
||||
|
|
|
@ -75,7 +75,7 @@ func (c *CalculatorPlugin) Query(ctx context.Context, query plugin.Query) []plug
|
|||
Icon: calculatorIcon,
|
||||
Actions: []plugin.QueryResultAction{
|
||||
{
|
||||
Name: "Copy result",
|
||||
Name: "i18n:plugin_calculator_copy_result",
|
||||
Action: func(ctx context.Context, actionContext plugin.ActionContext) {
|
||||
c.histories = append(c.histories, CalculatorHistory{
|
||||
Expression: query.Search,
|
||||
|
@ -99,6 +99,7 @@ func (c *CalculatorPlugin) Query(ctx context.Context, query plugin.Query) []plug
|
|||
Icon: calculatorIcon,
|
||||
Actions: []plugin.QueryResultAction{
|
||||
{
|
||||
Name: "i18n:plugin_calculator_copy_result",
|
||||
Action: func(ctx context.Context, actionContext plugin.ActionContext) {
|
||||
c.histories = append(c.histories, CalculatorHistory{
|
||||
Expression: query.Search,
|
||||
|
@ -129,14 +130,14 @@ func (c *CalculatorPlugin) Query(ctx context.Context, query plugin.Query) []plug
|
|||
Icon: calculatorIcon,
|
||||
Actions: []plugin.QueryResultAction{
|
||||
{
|
||||
Name: "Copy result",
|
||||
Name: "i18n:plugin_calculator_copy_result",
|
||||
IsDefault: true,
|
||||
Action: func(ctx context.Context, actionContext plugin.ActionContext) {
|
||||
clipboard.WriteText(h.Result)
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "Recalculate",
|
||||
Name: "i18n:plugin_calculator_recalculate",
|
||||
Action: func(ctx context.Context, actionContext plugin.ActionContext) {
|
||||
c.api.ChangeQuery(ctx, share.PlainQuery{
|
||||
QueryType: plugin.QueryTypeInput,
|
||||
|
@ -151,7 +152,7 @@ func (c *CalculatorPlugin) Query(ctx context.Context, query plugin.Query) []plug
|
|||
|
||||
if len(results) == 0 {
|
||||
results = append(results, plugin.QueryResult{
|
||||
Title: "Input expression to calculate",
|
||||
Title: "i18n:plugin_calculator_input_expression",
|
||||
Icon: calculatorIcon,
|
||||
Actions: []plugin.QueryResultAction{},
|
||||
})
|
||||
|
|
|
@ -64,13 +64,13 @@ func (c *Plugin) Query(ctx context.Context, query plugin.Query) []plugin.QueryRe
|
|||
Icon: fileIcon,
|
||||
Actions: []plugin.QueryResultAction{
|
||||
{
|
||||
Name: "Open",
|
||||
Name: "i18n:plugin_file_open",
|
||||
Action: func(ctx context.Context, actionContext plugin.ActionContext) {
|
||||
util.ShellOpen(item.Path)
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "Open containing folder",
|
||||
Name: "i18n:plugin_file_open_containing_folder",
|
||||
Action: func(ctx context.Context, actionContext plugin.ActionContext) {
|
||||
util.ShellOpenFileInFolder(item.Path)
|
||||
},
|
||||
|
|
|
@ -79,7 +79,7 @@ func (i *MenusPlugin) Query(ctx context.Context, query plugin.Query) []plugin.Qu
|
|||
Icon: icon,
|
||||
Actions: []plugin.QueryResultAction{
|
||||
{
|
||||
Name: "Execute",
|
||||
Name: "i18n:plugin_menus_execute",
|
||||
Action: func(ctx context.Context, actionContext plugin.ActionContext) {
|
||||
menus.ExecuteActiveAppMenu(query.Env.ActiveWindowPid, menu)
|
||||
},
|
||||
|
|
|
@ -57,14 +57,14 @@ func (i *QueryHistoryPlugin) Query(ctx context.Context, query plugin.Query) (res
|
|||
for k := len(queryHistories) - 1; k >= 0; k-- {
|
||||
var history = queryHistories[k]
|
||||
|
||||
if query.Search == "" || strings.Contains(history.Query.String(), query.Search) {
|
||||
if strings.Contains(history.Query.String(), query.Search) {
|
||||
results = append(results, plugin.QueryResult{
|
||||
Title: history.Query.String(),
|
||||
SubTitle: util.FormatTimestamp(history.Timestamp),
|
||||
Icon: queryHistoryIcon,
|
||||
Actions: []plugin.QueryResultAction{
|
||||
{
|
||||
Name: "Use",
|
||||
Name: "i18n:plugin_query_history_use",
|
||||
PreventHideAfterAction: true,
|
||||
Action: func(ctx context.Context, actionContext plugin.ActionContext) {
|
||||
i.api.ChangeQuery(ctx, history.Query)
|
||||
|
|
|
@ -2,6 +2,7 @@ package system
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
"runtime/pprof"
|
||||
|
@ -108,7 +109,7 @@ func (r *SysPlugin) Init(ctx context.Context, initParams plugin.InitParams) {
|
|||
|
||||
if util.IsDev() {
|
||||
r.commands = append(r.commands, SysCommand{
|
||||
Title: "Performance CPU profiling",
|
||||
Title: "i18n:plugin_sys_performance_cpu_profiling",
|
||||
Icon: plugin.CPUProfileIcon,
|
||||
Action: func(ctx context.Context, actionContext plugin.ActionContext) {
|
||||
cpuProfPath := path.Join(util.GetLocation().GetWoxDataDirectory(), "cpu.prof")
|
||||
|
@ -133,7 +134,7 @@ func (r *SysPlugin) Init(ctx context.Context, initParams plugin.InitParams) {
|
|||
})
|
||||
|
||||
r.commands = append(r.commands, SysCommand{
|
||||
Title: "Delete all image cache",
|
||||
Title: "i18n:plugin_sys_delete_image_cache",
|
||||
Icon: plugin.NewWoxImageEmoji("🗑️"),
|
||||
Action: func(ctx context.Context, actionContext plugin.ActionContext) {
|
||||
location := util.GetLocation()
|
||||
|
@ -184,12 +185,12 @@ func (r *SysPlugin) Query(ctx context.Context, query plugin.Query) (results []pl
|
|||
}
|
||||
|
||||
results = append(results, plugin.QueryResult{
|
||||
Title: "Open " + instance.Metadata.Name + " settings",
|
||||
Title: fmt.Sprintf(i18n.GetI18nManager().TranslateWox(ctx, "plugin_sys_open_plugin_settings"), instance.Metadata.Name),
|
||||
Score: score,
|
||||
Icon: pluginIcon,
|
||||
Actions: []plugin.QueryResultAction{
|
||||
{
|
||||
Name: "Open plugin settings",
|
||||
Name: "i18n:plugin_sys_execute",
|
||||
Action: func(ctx context.Context, actionContext plugin.ActionContext) {
|
||||
plugin.GetPluginManager().GetUI().OpenSettingWindow(ctx, share.SettingWindowContext{
|
||||
Path: "/plugin/setting",
|
||||
|
|
|
@ -82,7 +82,6 @@ func (r *UrlPlugin) getReg() *regexp.Regexp {
|
|||
}
|
||||
|
||||
func (r *UrlPlugin) Query(ctx context.Context, query plugin.Query) (results []plugin.QueryResult) {
|
||||
//check if search is in recentUrls
|
||||
if len(query.Search) >= 2 {
|
||||
existingUrlHistory := lo.Filter(r.recentUrls, func(item UrlHistory, index int) bool {
|
||||
return strings.Contains(strings.ToLower(item.Url), strings.ToLower(query.Search))
|
||||
|
@ -96,7 +95,7 @@ func (r *UrlPlugin) Query(ctx context.Context, query plugin.Query) (results []pl
|
|||
Icon: history.Icon.Overlay(urlIcon, 0.4, 0.6, 0.6),
|
||||
Actions: []plugin.QueryResultAction{
|
||||
{
|
||||
Name: "Open",
|
||||
Name: "i18n:plugin_url_open",
|
||||
Icon: plugin.OpenIcon,
|
||||
Action: func(ctx context.Context, actionContext plugin.ActionContext) {
|
||||
openErr := util.ShellOpen(history.Url)
|
||||
|
@ -106,7 +105,7 @@ func (r *UrlPlugin) Query(ctx context.Context, query plugin.Query) (results []pl
|
|||
},
|
||||
},
|
||||
{
|
||||
Name: "Remove from url history",
|
||||
Name: "i18n:plugin_url_remove",
|
||||
Icon: plugin.TrashIcon,
|
||||
Action: func(ctx context.Context, actionContext plugin.ActionContext) {
|
||||
r.removeRecentUrl(ctx, history.Url)
|
||||
|
@ -120,12 +119,12 @@ func (r *UrlPlugin) Query(ctx context.Context, query plugin.Query) (results []pl
|
|||
if len(r.reg.FindStringIndex(query.Search)) > 0 {
|
||||
results = append(results, plugin.QueryResult{
|
||||
Title: query.Search,
|
||||
SubTitle: "Open in Browser",
|
||||
SubTitle: "i18n:plugin_url_open_in_browser",
|
||||
Score: 100,
|
||||
Icon: urlIcon,
|
||||
Actions: []plugin.QueryResultAction{
|
||||
{
|
||||
Name: "Open",
|
||||
Name: "i18n:plugin_url_open",
|
||||
Icon: urlIcon,
|
||||
Action: func(ctx context.Context, actionContext plugin.ActionContext) {
|
||||
url := query.Search
|
||||
|
@ -145,7 +144,6 @@ func (r *UrlPlugin) Query(ctx context.Context, query plugin.Query) (results []pl
|
|||
},
|
||||
})
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import (
|
|||
"path"
|
||||
"strings"
|
||||
"time"
|
||||
"wox/i18n"
|
||||
"wox/plugin"
|
||||
"wox/setting/definition"
|
||||
"wox/share"
|
||||
|
@ -81,31 +82,31 @@ func (w *WPMPlugin) GetMetadata() plugin.Metadata {
|
|||
Commands: []plugin.MetadataCommand{
|
||||
{
|
||||
Command: "install",
|
||||
Description: "Install Wox plugins",
|
||||
Description: "i18n:plugin_wpm_command_install",
|
||||
},
|
||||
{
|
||||
Command: "uninstall",
|
||||
Description: "Uninstall Wox plugins",
|
||||
Description: "i18n:plugin_wpm_command_uninstall",
|
||||
},
|
||||
{
|
||||
Command: "create",
|
||||
Description: "Create Wox plugin",
|
||||
Description: "i18n:plugin_wpm_command_create",
|
||||
},
|
||||
{
|
||||
Command: "dev.list",
|
||||
Description: "List local Wox plugins",
|
||||
Description: "i18n:plugin_wpm_command_dev_list",
|
||||
},
|
||||
{
|
||||
Command: "dev.add",
|
||||
Description: "Add existing Wox plugin directory",
|
||||
Description: "i18n:plugin_wpm_command_dev_add",
|
||||
},
|
||||
{
|
||||
Command: "dev.remove",
|
||||
Description: "Remove local Wox plugin, followed by a directory",
|
||||
Description: "i18n:plugin_wpm_command_dev_remove",
|
||||
},
|
||||
{
|
||||
Command: "dev.reload",
|
||||
Description: "Reload all dev plugins",
|
||||
Description: "i18n:plugin_wpm_command_dev_reload",
|
||||
},
|
||||
},
|
||||
SupportedOS: []string{
|
||||
|
@ -118,12 +119,12 @@ func (w *WPMPlugin) GetMetadata() plugin.Metadata {
|
|||
Type: definition.PluginSettingDefinitionTypeTable,
|
||||
Value: &definition.PluginSettingValueTable{
|
||||
Key: localPluginDirectoriesKey,
|
||||
Title: "Local Plugin Directories",
|
||||
Tooltip: "The directories to load local plugins, useful for plugin development",
|
||||
Title: "i18n:plugin_wpm_local_plugin_directories",
|
||||
Tooltip: "i18n:plugin_wpm_local_plugin_directories_tooltip",
|
||||
Columns: []definition.PluginSettingValueTableColumn{
|
||||
{
|
||||
Key: "path",
|
||||
Label: "Path",
|
||||
Label: "i18n:plugin_wpm_path",
|
||||
Type: definition.PluginSettingValueTableColumnTypeDirPath,
|
||||
},
|
||||
},
|
||||
|
@ -247,7 +248,7 @@ func (w *WPMPlugin) parseMetadata(ctx context.Context, directory string) (plugin
|
|||
|
||||
func (w *WPMPlugin) Query(ctx context.Context, query plugin.Query) []plugin.QueryResult {
|
||||
if query.Command == "create" {
|
||||
return w.createCommand(query)
|
||||
return w.createCommand(ctx, query)
|
||||
}
|
||||
|
||||
if query.Command == "install" {
|
||||
|
@ -277,13 +278,13 @@ func (w *WPMPlugin) Query(ctx context.Context, query plugin.Query) []plugin.Quer
|
|||
return []plugin.QueryResult{}
|
||||
}
|
||||
|
||||
func (w *WPMPlugin) createCommand(query plugin.Query) []plugin.QueryResult {
|
||||
func (w *WPMPlugin) createCommand(ctx context.Context, query plugin.Query) []plugin.QueryResult {
|
||||
if w.creatingProcess != "" {
|
||||
return []plugin.QueryResult{
|
||||
{
|
||||
Id: uuid.NewString(),
|
||||
Title: w.creatingProcess,
|
||||
SubTitle: "Please wait...",
|
||||
SubTitle: "i18n:plugin_wpm_please_wait",
|
||||
Icon: wpmIcon,
|
||||
RefreshInterval: 300,
|
||||
OnRefresh: func(ctx context.Context, current plugin.RefreshableResult) plugin.RefreshableResult {
|
||||
|
@ -298,12 +299,12 @@ func (w *WPMPlugin) createCommand(query plugin.Query) []plugin.QueryResult {
|
|||
for _, template := range pluginTemplates {
|
||||
results = append(results, plugin.QueryResult{
|
||||
Id: uuid.NewString(),
|
||||
Title: "Create " + string(template.Runtime) + " plugin",
|
||||
SubTitle: fmt.Sprintf("Name: %s", query.Search),
|
||||
Title: fmt.Sprintf(i18n.GetI18nManager().TranslateWox(ctx, "plugin_wpm_create_plugin"), string(template.Runtime)),
|
||||
SubTitle: fmt.Sprintf(i18n.GetI18nManager().TranslateWox(ctx, "plugin_wpm_plugin_name"), query.Search),
|
||||
Icon: wpmIcon,
|
||||
Actions: []plugin.QueryResultAction{
|
||||
{
|
||||
Name: "create",
|
||||
Name: "i18n:plugin_wpm_create",
|
||||
PreventHideAfterAction: true,
|
||||
Action: func(ctx context.Context, actionContext plugin.ActionContext) {
|
||||
pluginName := query.Search
|
||||
|
@ -348,7 +349,7 @@ func (w *WPMPlugin) uninstallCommand(ctx context.Context, query plugin.Query) []
|
|||
Icon: icon,
|
||||
Actions: []plugin.QueryResultAction{
|
||||
{
|
||||
Name: "uninstall",
|
||||
Name: "i18n:plugin_wpm_uninstall",
|
||||
Action: func(ctx context.Context, actionContext plugin.ActionContext) {
|
||||
plugin.GetStoreManager().Uninstall(ctx, pluginInstance)
|
||||
},
|
||||
|
@ -398,11 +399,11 @@ func (w *WPMPlugin) installCommand(ctx context.Context, query plugin.Query) []pl
|
|||
},
|
||||
Actions: []plugin.QueryResultAction{
|
||||
{
|
||||
Name: "install",
|
||||
Name: "i18n:plugin_wpm_install",
|
||||
Action: func(ctx context.Context, actionContext plugin.ActionContext) {
|
||||
installErr := plugin.GetStoreManager().Install(ctx, pluginManifest)
|
||||
if installErr != nil {
|
||||
w.api.Notify(ctx, installErr.Error())
|
||||
w.api.Notify(ctx, "i18n:plugin_wpm_install_failed")
|
||||
}
|
||||
},
|
||||
},
|
||||
|
@ -445,23 +446,23 @@ func (w *WPMPlugin) listDevCommand(ctx context.Context) []plugin.QueryResult {
|
|||
},
|
||||
Actions: []plugin.QueryResultAction{
|
||||
{
|
||||
Name: "Reload",
|
||||
Name: "i18n:plugin_wpm_reload",
|
||||
IsDefault: true,
|
||||
Action: func(ctx context.Context, actionContext plugin.ActionContext) {
|
||||
w.reloadLocalDistPlugin(ctx, lp.metadata, "reload by user")
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "Open plugin directory",
|
||||
Name: "i18n:plugin_wpm_open_directory",
|
||||
Action: func(ctx context.Context, actionContext plugin.ActionContext) {
|
||||
openErr := util.ShellOpen(lp.metadata.Directory)
|
||||
if openErr != nil {
|
||||
w.api.Notify(ctx, fmt.Sprintf("Failed to open plugin directory: %s", openErr.Error()))
|
||||
w.api.Notify(ctx, fmt.Sprintf(i18n.GetI18nManager().TranslateWox(ctx, "plugin_wpm_open_directory_failed"), openErr.Error()))
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "Remove",
|
||||
Name: "i18n:plugin_wpm_remove",
|
||||
Action: func(ctx context.Context, actionContext plugin.ActionContext) {
|
||||
w.localPluginDirectories = lo.Filter(w.localPluginDirectories, func(directory string, _ int) bool {
|
||||
return directory != lp.metadata.Directory
|
||||
|
@ -470,7 +471,7 @@ func (w *WPMPlugin) listDevCommand(ctx context.Context) []plugin.QueryResult {
|
|||
},
|
||||
},
|
||||
{
|
||||
Name: "Remove and delete plugin directory",
|
||||
Name: "i18n:plugin_wpm_remove_and_delete",
|
||||
Action: func(ctx context.Context, actionContext plugin.ActionContext) {
|
||||
deleteErr := os.RemoveAll(lp.metadata.Directory)
|
||||
if deleteErr != nil {
|
||||
|
@ -492,11 +493,11 @@ func (w *WPMPlugin) listDevCommand(ctx context.Context) []plugin.QueryResult {
|
|||
func (w *WPMPlugin) reloadDevCommand(ctx context.Context) []plugin.QueryResult {
|
||||
return []plugin.QueryResult{
|
||||
{
|
||||
Title: "Reload all dev plugins",
|
||||
Title: "i18n:plugin_wpm_reload_all_plugins",
|
||||
Icon: wpmIcon,
|
||||
Actions: []plugin.QueryResultAction{
|
||||
{
|
||||
Name: "Reload",
|
||||
Name: "i18n:plugin_wpm_reload",
|
||||
Action: func(ctx context.Context, actionContext plugin.ActionContext) {
|
||||
w.reloadAllDevPlugins(ctx)
|
||||
util.Go(ctx, "reload dev plugins in dist", func() {
|
||||
|
@ -516,14 +517,14 @@ func (w *WPMPlugin) addDevCommand(ctx context.Context, query plugin.Query) []plu
|
|||
w.api.Log(ctx, plugin.LogLevelInfo, "Please choose a directory to add local plugin")
|
||||
pluginDirectories := plugin.GetPluginManager().GetUI().PickFiles(ctx, share.PickFilesParams{IsDirectory: true})
|
||||
if len(pluginDirectories) == 0 {
|
||||
w.api.Notify(ctx, "You need to choose a directory to add local plugin")
|
||||
w.api.Notify(ctx, "i18n:plugin_wpm_choose_directory")
|
||||
return []plugin.QueryResult{}
|
||||
}
|
||||
|
||||
pluginDirectory := pluginDirectories[0]
|
||||
|
||||
if lo.Contains(w.localPluginDirectories, pluginDirectory) {
|
||||
w.api.Notify(ctx, "The plugin directory has already been added")
|
||||
w.api.Notify(ctx, "i18n:plugin_wpm_directory_already_added")
|
||||
return []plugin.QueryResult{}
|
||||
}
|
||||
|
||||
|
@ -536,13 +537,13 @@ func (w *WPMPlugin) addDevCommand(ctx context.Context, query plugin.Query) []plu
|
|||
|
||||
func (w *WPMPlugin) removeDevCommand(ctx context.Context, query plugin.Query) []plugin.QueryResult {
|
||||
if len(query.Search) == 0 {
|
||||
w.api.Notify(ctx, "You need to input a directory to remove local plugin")
|
||||
w.api.Notify(ctx, "i18n:plugin_wpm_input_directory")
|
||||
return []plugin.QueryResult{}
|
||||
}
|
||||
|
||||
pluginDirectory := query.Search
|
||||
if !lo.Contains(w.localPluginDirectories, pluginDirectory) {
|
||||
w.api.Notify(ctx, "The plugin directory is not found")
|
||||
w.api.Notify(ctx, "i18n:plugin_wpm_directory_not_found")
|
||||
return []plugin.QueryResult{}
|
||||
}
|
||||
|
||||
|
@ -554,33 +555,33 @@ func (w *WPMPlugin) removeDevCommand(ctx context.Context, query plugin.Query) []
|
|||
}
|
||||
|
||||
func (w *WPMPlugin) createPlugin(ctx context.Context, template pluginTemplate, pluginName string, query plugin.Query) {
|
||||
w.creatingProcess = "Downloading template..."
|
||||
w.creatingProcess = "i18n:plugin_wpm_downloading_template"
|
||||
|
||||
tempPluginDirectory := path.Join(os.TempDir(), uuid.NewString())
|
||||
if err := util.GetLocation().EnsureDirectoryExist(tempPluginDirectory); err != nil {
|
||||
w.api.Log(ctx, plugin.LogLevelError, fmt.Sprintf("Failed to create temp plugin directory: %s", err.Error()))
|
||||
w.creatingProcess = fmt.Sprintf("Failed to create temp plugin directory: %s", err.Error())
|
||||
w.creatingProcess = fmt.Sprintf(i18n.GetI18nManager().TranslateWox(ctx, "plugin_wpm_create_temp_dir_failed"), err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
w.creatingProcess = fmt.Sprintf("Downloading %s template to %s", template.Runtime, tempPluginDirectory)
|
||||
w.creatingProcess = fmt.Sprintf(i18n.GetI18nManager().TranslateWox(ctx, "plugin_wpm_downloading_template_to"), template.Runtime, tempPluginDirectory)
|
||||
tempZipPath := path.Join(tempPluginDirectory, "template.zip")
|
||||
err := util.HttpDownload(ctx, template.Url, tempZipPath)
|
||||
if err != nil {
|
||||
w.api.Log(ctx, plugin.LogLevelError, fmt.Sprintf("Failed to download template: %s", err.Error()))
|
||||
w.creatingProcess = fmt.Sprintf("Failed to download template: %s", err.Error())
|
||||
w.creatingProcess = fmt.Sprintf(i18n.GetI18nManager().TranslateWox(ctx, "plugin_wpm_download_template_failed"), err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
w.creatingProcess = "Extracting template..."
|
||||
w.creatingProcess = "i18n:plugin_wpm_extracting_template"
|
||||
err = util.Unzip(tempZipPath, tempPluginDirectory)
|
||||
if err != nil {
|
||||
w.api.Log(ctx, plugin.LogLevelError, fmt.Sprintf("Failed to extract template: %s", err.Error()))
|
||||
w.creatingProcess = fmt.Sprintf("Failed to extract template: %s", err.Error())
|
||||
w.creatingProcess = fmt.Sprintf(i18n.GetI18nManager().TranslateWox(ctx, "plugin_wpm_extract_template_failed"), err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
w.creatingProcess = "Please choose a directory..."
|
||||
w.creatingProcess = "i18n:plugin_wpm_choose_directory_prompt"
|
||||
pluginDirectories := plugin.GetPluginManager().GetUI().PickFiles(ctx, share.PickFilesParams{IsDirectory: true})
|
||||
if len(pluginDirectories) == 0 {
|
||||
w.api.Notify(ctx, "You need to choose a directory to create the plugin")
|
||||
|
@ -691,6 +692,6 @@ func (w *WPMPlugin) reloadLocalDistPlugin(ctx context.Context, localPlugin plugi
|
|||
w.api.Log(ctx, plugin.LogLevelInfo, fmt.Sprintf("Reloaded plugin: %s", localPlugin.Metadata.Name))
|
||||
}
|
||||
|
||||
w.api.Notify(ctx, fmt.Sprintf("Reloaded dev plugin %s(%s)", localPlugin.Metadata.Name, reason))
|
||||
w.api.Notify(ctx, fmt.Sprintf(i18n.GetI18nManager().TranslateWox(ctx, "plugin_wpm_reload_success"), localPlugin.Metadata.Name, reason))
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -1,5 +1,29 @@
|
|||
{
|
||||
"show_wox_preferences": "Show Wox Preferences",
|
||||
"selection_no_files_selected": "No files selected",
|
||||
"selection_selected_files_count": "Selected %d files:",
|
||||
"selection_remaining_files_not_shown": "... %d more files not shown",
|
||||
"ui_hotkey": "Hotkey",
|
||||
"ui_hotkey_tips": "Hotkeys to open or hide Wox",
|
||||
"ui_selection_hotkey": "Selection Hotkey",
|
||||
"ui_selection_hotkey_tips": "Hotkeys to do actions on selected text or files",
|
||||
"ui_use_pinyin": "Use Pinyin",
|
||||
"ui_use_pinyin_tips": "When selected, Wox will convert Chinese into Pinyin",
|
||||
"ui_hide_on_lost_focus": "Hide on lost focus",
|
||||
"ui_hide_on_lost_focus_tips": "When selected, Wox will hide when it loses focus",
|
||||
"ui_hide_on_start": "Hide on start",
|
||||
"ui_hide_on_start_tips": "When selected, Wox will hide when it starts",
|
||||
"ui_show_tray": "Show tray icon",
|
||||
"ui_show_tray_tips": "When selected, Wox will show a tray icon",
|
||||
"ui_switch_input_method_abc": "Switch to ABC",
|
||||
"ui_switch_input_method_abc_tips": "When selected, the input method will be switched to english",
|
||||
"ui_lang": "Language",
|
||||
"ui_query_hotkeys": "Query Hotkeys",
|
||||
"ui_query_shortcuts": "Query Shortcuts",
|
||||
"ui_general": "General",
|
||||
"ui_ai": "AI",
|
||||
"ui_autostart": "Autostart",
|
||||
"ui_autostart_tips": "When selected, Wox will start automatically when the computer starts",
|
||||
"plugin_app_open": "Open",
|
||||
"plugin_app_open_containing_folder": "Open Containing Folder",
|
||||
"plugin_app_copy_path": "Copy Path",
|
||||
|
@ -23,6 +47,9 @@
|
|||
"plugin_sys_quit_wox": "Exit",
|
||||
"plugin_sys_open_wox_settings": "Open Wox Settings",
|
||||
"plugin_sys_open_system_settings": "Open System Settings",
|
||||
"plugin_sys_performance_cpu_profiling": "Performance CPU profiling",
|
||||
"plugin_sys_delete_image_cache": "Delete all image cache",
|
||||
"plugin_sys_open_plugin_settings": "Open %s settings",
|
||||
"plugin_websearch_trigger_keyword": "keyword",
|
||||
"plugin_websearch_trigger_keyword_tooltip": "The trigger keyword you want to use to trigger the search",
|
||||
"plugin_websearch_title": "Title",
|
||||
|
@ -34,28 +61,81 @@
|
|||
"plugin_websearch_is_fallback_tooltip": "If enabled, this search will be used if no other search matches the query",
|
||||
"plugin_websearch_icon": "Icon",
|
||||
"plugin_websearch_web_searches": "Web Searches",
|
||||
"ui_hotkey": "Hotkey",
|
||||
"ui_hotkey_tips": "Hotkeys to open or hide Wox",
|
||||
"ui_selection_hotkey": "Selection Hotkey",
|
||||
"ui_selection_hotkey_tips": "Hotkeys to do actions on selected text or files",
|
||||
"ui_use_pinyin": "Use Pinyin",
|
||||
"ui_use_pinyin_tips": "When selected, Wox will convert Chinese into Pinyin",
|
||||
"ui_hide_on_lost_focus": "Hide on lost focus",
|
||||
"ui_hide_on_lost_focus_tips": "When selected, Wox will hide when it loses focus",
|
||||
"ui_hide_on_start": "Hide on start",
|
||||
"ui_hide_on_start_tips": "When selected, Wox will hide when it starts",
|
||||
"ui_show_tray": "Show tray icon",
|
||||
"ui_show_tray_tips": "When selected, Wox will show a tray icon",
|
||||
"ui_switch_input_method_abc": "Switch to ABC",
|
||||
"ui_switch_input_method_abc_tips": "When selected, the input method will be switched to english",
|
||||
"ui_lang": "Language",
|
||||
"ui_query_hotkeys": "Query Hotkeys",
|
||||
"ui_query_shortcuts": "Query Shortcuts",
|
||||
"ui_general": "General",
|
||||
"ui_ai": "AI",
|
||||
"ui_autostart": "Autostart",
|
||||
"ui_autostart_tips": "When selected, Wox will start automatically when the computer starts",
|
||||
"selection_no_files_selected": "No files selected",
|
||||
"selection_selected_files_count": "Selected %d files:",
|
||||
"selection_remaining_files_not_shown": "... %d more files not shown"
|
||||
"plugin_url_open": "Open",
|
||||
"plugin_url_remove": "Remove from url history",
|
||||
"plugin_url_open_in_browser": "Open in browser",
|
||||
"plugin_doctor_version": "Version",
|
||||
"plugin_doctor_version_latest": "Already using the latest version: %s",
|
||||
"plugin_doctor_version_update_available": "New version available, current: %s, latest: %s",
|
||||
"plugin_doctor_version_download": "Go to download page",
|
||||
"plugin_doctor_accessibility": "Accessibility",
|
||||
"plugin_doctor_accessibility_required": "You need to grant Wox Accessibility permission to use this plugin",
|
||||
"plugin_doctor_accessibility_open_settings": "Open Accessibility Settings",
|
||||
"plugin_doctor_accessibility_granted": "You have granted Wox Accessibility permission",
|
||||
"plugin_query_history_use": "Use",
|
||||
"plugin_browser_open_tab": "Open",
|
||||
"plugin_browser_server_port": "Server Port",
|
||||
"plugin_browser_server_port_tooltip": "The port for the websocket server to communicate with the browser extension. Default is 34988.",
|
||||
"plugin_browser_server_start_error": "Failed to start websocket server: %s",
|
||||
"plugin_menus_execute": "Execute",
|
||||
"plugin_wpm_please_wait": "Please wait...",
|
||||
"plugin_wpm_create_plugin": "Create %s plugin",
|
||||
"plugin_wpm_plugin_name": "Name: %s",
|
||||
"plugin_wpm_create": "Create",
|
||||
"plugin_wpm_uninstall": "Uninstall",
|
||||
"plugin_wpm_install": "Install",
|
||||
"plugin_wpm_install_failed": "Failed to install plugin",
|
||||
"plugin_wpm_reload": "Reload",
|
||||
"plugin_wpm_open_directory": "Open plugin directory",
|
||||
"plugin_wpm_open_directory_failed": "Failed to open plugin directory: %s",
|
||||
"plugin_wpm_remove": "Remove",
|
||||
"plugin_wpm_remove_and_delete": "Remove and delete plugin directory",
|
||||
"plugin_wpm_reload_all_plugins": "Reload all dev plugins",
|
||||
"plugin_wpm_choose_directory": "You need to choose a directory to add local plugin",
|
||||
"plugin_wpm_directory_already_added": "The plugin directory has already been added",
|
||||
"plugin_wpm_input_directory": "You need to input a directory to remove local plugin",
|
||||
"plugin_wpm_directory_not_found": "The plugin directory is not found",
|
||||
"plugin_wpm_reload_success": "Reloaded dev plugin %s(%s)",
|
||||
"plugin_wpm_downloading_template": "Downloading template...",
|
||||
"plugin_wpm_create_temp_dir_failed": "Failed to create temp plugin directory: %s",
|
||||
"plugin_wpm_downloading_template_to": "Downloading %s template to %s",
|
||||
"plugin_wpm_download_template_failed": "Failed to download template: %s",
|
||||
"plugin_wpm_extracting_template": "Extracting template...",
|
||||
"plugin_wpm_extract_template_failed": "Failed to extract template: %s",
|
||||
"plugin_wpm_choose_directory_prompt": "Please choose a directory...",
|
||||
"plugin_wpm_command_install": "Install Wox plugins",
|
||||
"plugin_wpm_command_uninstall": "Uninstall Wox plugins",
|
||||
"plugin_wpm_command_create": "Create Wox plugin",
|
||||
"plugin_wpm_command_dev_list": "List local Wox plugins",
|
||||
"plugin_wpm_command_dev_add": "Add existing Wox plugin directory",
|
||||
"plugin_wpm_command_dev_remove": "Remove local Wox plugin, followed by a directory",
|
||||
"plugin_wpm_command_dev_reload": "Reload all dev plugins",
|
||||
"plugin_wpm_local_plugin_directories": "Local Plugin Directories",
|
||||
"plugin_wpm_local_plugin_directories_tooltip": "The directories to load local plugins, useful for plugin development",
|
||||
"plugin_wpm_path": "Path",
|
||||
"plugin_ai_command_description": "Make your daily tasks easier with AI commands",
|
||||
"plugin_ai_command_commands": "Commands",
|
||||
"plugin_ai_command_commands_tooltip": "The commands to run.\r\nE.g. `translate`, user will type `ai translate` to run translate based on the prompt",
|
||||
"plugin_ai_command_enter_to_start": "Enter to start chat",
|
||||
"plugin_ai_command_run": "Run",
|
||||
"plugin_ai_command_answering": "Answering...",
|
||||
"plugin_ai_command_answered_cost": "Answered, cost %d ms",
|
||||
"plugin_ai_command_copy": "Copy",
|
||||
"plugin_ai_command_no_commands": "No AI commands found",
|
||||
"plugin_ai_command_type_to_start": "Type to start chat",
|
||||
"plugin_ai_command_not_found": "No AI command found",
|
||||
"plugin_ai_command_empty_prompt": "Prompt is empty for this AI command",
|
||||
"plugin_ai_command_chat_with": "Chat with %s",
|
||||
"plugin_backup_now": "Backup now",
|
||||
"plugin_backup_subtitle": "Backup Wox settings",
|
||||
"plugin_backup_action": "Backup",
|
||||
"plugin_backup_success": "Wox settings backed up",
|
||||
"plugin_backup_error": "Error",
|
||||
"plugin_backup_restore": "Restore",
|
||||
"plugin_backup_restore_success": "Wox settings restored",
|
||||
"plugin_calculator_copy_result": "Copy result",
|
||||
"plugin_calculator_recalculate": "Recalculate",
|
||||
"plugin_calculator_input_expression": "Input expression to calculate",
|
||||
"plugin_file_open": "Open",
|
||||
"plugin_file_open_containing_folder": "Open containing folder"
|
||||
}
|
|
@ -1,5 +1,29 @@
|
|||
{
|
||||
"show_wox_preferences": "显示 Wox 设置",
|
||||
"selection_no_files_selected": "未选择文件",
|
||||
"selection_selected_files_count": "已选择 %d 个文件:",
|
||||
"selection_remaining_files_not_shown": "... 还有 %d 个文件未显示",
|
||||
"ui_hotkey": "快捷键",
|
||||
"ui_hotkey_tips": "用于显示或隐藏Wox的快捷键",
|
||||
"ui_selection_hotkey": "选择快捷键",
|
||||
"ui_selection_hotkey_tips": "用于在选定的文本或文件上执行操作的快捷键",
|
||||
"ui_use_pinyin": "使用拼音",
|
||||
"ui_use_pinyin_tips": "搜索时,把中文转换为拼音",
|
||||
"ui_hide_on_lost_focus": "失去焦点时隐藏",
|
||||
"ui_hide_on_lost_focus_tips": "选中后,Wox失去焦点时将隐藏",
|
||||
"ui_hide_on_start": "启动时隐藏",
|
||||
"ui_hide_on_start_tips": "选中后,Wox启动时将隐藏",
|
||||
"ui_show_tray": "显示托盘图标",
|
||||
"ui_show_tray_tips": "选中后,Wox将显示托盘图标",
|
||||
"ui_switch_input_method_abc": "切换输入法",
|
||||
"ui_switch_input_method_abc_tips": "选中后,输入法将切换到英文",
|
||||
"ui_lang": "语言",
|
||||
"ui_query_hotkeys": "查询快捷",
|
||||
"ui_query_shortcuts": "查询缩写",
|
||||
"ui_general": "通用",
|
||||
"ui_ai": "AI",
|
||||
"ui_autostart": "开机自启动",
|
||||
"ui_autostart_tips": "选中后,Wox将在电脑开机时自动启动",
|
||||
"plugin_app_open": "打开",
|
||||
"plugin_app_open_containing_folder": "打开所在文件夹",
|
||||
"plugin_app_copy_path": "复制路径",
|
||||
|
@ -23,6 +47,9 @@
|
|||
"plugin_sys_quit_wox": "退出Wox",
|
||||
"plugin_sys_open_wox_settings": "打开Wox设置",
|
||||
"plugin_sys_open_system_settings": "打开系统设置",
|
||||
"plugin_sys_performance_cpu_profiling": "性能 CPU 分析",
|
||||
"plugin_sys_delete_image_cache": "删除所有图片缓存",
|
||||
"plugin_sys_open_plugin_settings": "打开 %s 设置",
|
||||
"plugin_websearch_trigger_keyword": "关键字",
|
||||
"plugin_websearch_trigger_keyword_tooltip": "输入触发关键字触发该网页搜索",
|
||||
"plugin_websearch_title": "标题",
|
||||
|
@ -34,28 +61,81 @@
|
|||
"plugin_websearch_is_fallback_tooltip": "当没有搜索结果匹配当前的查询时, 使用该条网页搜索作为回退搜索",
|
||||
"plugin_websearch_icon": "图标",
|
||||
"plugin_websearch_web_searches": "网页搜索",
|
||||
"ui_hotkey": "快捷键",
|
||||
"ui_hotkey_tips": "用于显示或隐藏Wox的快捷键",
|
||||
"ui_selection_hotkey": "选择快捷键",
|
||||
"ui_selection_hotkey_tips": "用于在选定的文本或文件上执行操作的快捷键",
|
||||
"ui_use_pinyin": "使用拼音",
|
||||
"ui_use_pinyin_tips": "搜索时,把中文转换为拼音",
|
||||
"ui_hide_on_lost_focus": "失去焦点时隐藏",
|
||||
"ui_hide_on_lost_focus_tips": "选中后,Wox失去焦点时将隐藏",
|
||||
"ui_hide_on_start": "启动时隐藏",
|
||||
"ui_hide_on_start_tips": "选中后,Wox启动时将隐藏",
|
||||
"ui_show_tray": "显示托盘图标",
|
||||
"ui_show_tray_tips": "选中后,Wox将显示托盘图标",
|
||||
"ui_switch_input_method_abc": "切换输入法",
|
||||
"ui_switch_input_method_abc_tips": "选中后,输入法将切换到英文",
|
||||
"ui_lang": "语言",
|
||||
"ui_query_hotkeys": "查询快捷键",
|
||||
"ui_query_shortcuts": "查询缩写",
|
||||
"ui_general": "通用",
|
||||
"ui_ai": "AI",
|
||||
"ui_autostart": "开机自启动",
|
||||
"ui_autostart_tips": "选中后,Wox将在电脑开机时自动启动",
|
||||
"selection_no_files_selected": "未选择文件",
|
||||
"selection_selected_files_count": "已选择 %d 个文件:",
|
||||
"selection_remaining_files_not_shown": "... 还有 %d 个文件未显示"
|
||||
"plugin_doctor_version": "版本",
|
||||
"plugin_doctor_version_latest": "已经是最新版本:%s",
|
||||
"plugin_doctor_version_update_available": "发现新版本,当前版:%s,最新版本:%s",
|
||||
"plugin_doctor_version_download": "前往下载页面",
|
||||
"plugin_doctor_accessibility": "辅助功能",
|
||||
"plugin_doctor_accessibility_required": "您需要授予 Wox 辅助功能权限才能使用此插件",
|
||||
"plugin_doctor_accessibility_open_settings": "打开辅助功能设置",
|
||||
"plugin_doctor_accessibility_granted": "您已授予 Wox 辅助功能权限",
|
||||
"plugin_query_history_use": "使用",
|
||||
"plugin_url_open": "打开",
|
||||
"plugin_url_remove": "从历史记录中移除",
|
||||
"plugin_url_open_in_browser": "在浏览器中打开",
|
||||
"plugin_browser_open_tab": "打开标签页",
|
||||
"plugin_browser_server_port": "服务器端口",
|
||||
"plugin_browser_server_port_tooltip": "用于与浏览器扩展通信的websocket服务器端口。默认是34988。",
|
||||
"plugin_browser_server_start_error": "启动 websocket 服务器失败: %s",
|
||||
"plugin_menus_execute": "执行",
|
||||
"plugin_wpm_please_wait": "请稍候...",
|
||||
"plugin_wpm_create_plugin": "创建 %s 插件",
|
||||
"plugin_wpm_plugin_name": "名称:%s",
|
||||
"plugin_wpm_create": "创建",
|
||||
"plugin_wpm_uninstall": "卸载",
|
||||
"plugin_wpm_install": "安装",
|
||||
"plugin_wpm_install_failed": "安装插件失败",
|
||||
"plugin_wpm_reload": "重新加载",
|
||||
"plugin_wpm_open_directory": "打开插件目录",
|
||||
"plugin_wpm_open_directory_failed": "打开插件目录失败:%s",
|
||||
"plugin_wpm_remove": "移除",
|
||||
"plugin_wpm_remove_and_delete": "移除并删除插件目录",
|
||||
"plugin_wpm_reload_all_plugins": "重新加载所有开发插件",
|
||||
"plugin_wpm_choose_directory": "您需要选择一个目录来添加本地插件",
|
||||
"plugin_wpm_directory_already_added": "该插件目录已经添加过了",
|
||||
"plugin_wpm_input_directory": "您需要输入一个目录来移除本地插件",
|
||||
"plugin_wpm_directory_not_found": "未找到该插件目录",
|
||||
"plugin_wpm_reload_success": "已重新加载开发插件 %s(%s)",
|
||||
"plugin_wpm_downloading_template": "正在下载模板...",
|
||||
"plugin_wpm_create_temp_dir_failed": "创建临时插件目录失败:%s",
|
||||
"plugin_wpm_downloading_template_to": "正在下载 %s 模板到 %s",
|
||||
"plugin_wpm_download_template_failed": "下载模板失败:%s",
|
||||
"plugin_wpm_extracting_template": "正在解压模板...",
|
||||
"plugin_wpm_extract_template_failed": "解压模板失败:%s",
|
||||
"plugin_wpm_choose_directory_prompt": "请选择一目录...",
|
||||
"plugin_wpm_command_install": "安装 Wox 插件",
|
||||
"plugin_wpm_command_uninstall": "卸载 Wox 插件",
|
||||
"plugin_wpm_command_create": "创建 Wox 插件",
|
||||
"plugin_wpm_command_dev_list": "列出本地 Wox 插件",
|
||||
"plugin_wpm_command_dev_add": "添加现有的 Wox 插件目录",
|
||||
"plugin_wpm_command_dev_remove": "移除本地 Wox 插件,后跟目录",
|
||||
"plugin_wpm_command_dev_reload": "重新加载所有开发插件",
|
||||
"plugin_wpm_local_plugin_directories": "本地插件目录",
|
||||
"plugin_wpm_local_plugin_directories_tooltip": "用于加载本地插件的目录,对插件开发有用",
|
||||
"plugin_wpm_path": "路径",
|
||||
"plugin_ai_command_description": "使用 AI 命令让日常任务更简单",
|
||||
"plugin_ai_command_commands": "命令",
|
||||
"plugin_ai_command_commands_tooltip": "要运行的命令。\r\n例如:`translate`,用户将输入 `ai translate` 来根据提示词运行翻译",
|
||||
"plugin_ai_command_enter_to_start": "按回车开始对话",
|
||||
"plugin_ai_command_run": "运行",
|
||||
"plugin_ai_command_answering": "正在回答...",
|
||||
"plugin_ai_command_answered_cost": "已回答,耗时 %d 毫秒",
|
||||
"plugin_ai_command_copy": "复制",
|
||||
"plugin_ai_command_no_commands": "未找到 AI 命令",
|
||||
"plugin_ai_command_type_to_start": "输入内容开始对话",
|
||||
"plugin_ai_command_not_found": "未找到 AI 命令",
|
||||
"plugin_ai_command_empty_prompt": "该 AI 命令的提示词为空",
|
||||
"plugin_ai_command_chat_with": "与 %s 对话",
|
||||
"plugin_backup_now": "立即备份",
|
||||
"plugin_backup_subtitle": "备份 Wox 设置",
|
||||
"plugin_backup_action": "备份",
|
||||
"plugin_backup_success": "Wox 设置已备份",
|
||||
"plugin_backup_error": "错误",
|
||||
"plugin_backup_restore": "恢复",
|
||||
"plugin_backup_restore_success": "Wox 设置已恢复",
|
||||
"plugin_calculator_copy_result": "复制结果",
|
||||
"plugin_calculator_recalculate": "重新计算",
|
||||
"plugin_calculator_input_expression": "输入表达式进行计算",
|
||||
"plugin_file_open": "打开",
|
||||
"plugin_file_open_containing_folder": "打开所在文件夹"
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
参考一下 @wpm.go @lang 文件中关于i18n的用法, 把 @ai_command.go 的i18n实现一下, 要求如下:
|
||||
|
||||
- 不要更改任何原有逻辑, 仅仅实现i18n
|
||||
- 实现i18n的时候, 不要在i18n后面添加注释
|
||||
- Log信息不需要添加翻译
|
||||
- plugin.Metadata的name,author不需要添加翻译
|
||||
- plugin.MetadataCommand的Description需要翻译
|
||||
- api.Notify需要翻译
|
||||
- plugin.QueryResult里面的title, subtitle需要翻译
|
||||
- definition.PluginSettingDefinitions里面的需要翻译
|
||||
- plugin.QueryResultAction的Name需要翻译
|
||||
- 对于有变量的字符串, 使用 fmt.Sprintf(i18n.GetI18nManager().TranslateWox(ctx, "plugin_sys_open_plugin_settings"), instance.Metadata.Name) 这种形式
|
||||
- 对于纯字符串的翻译, 直接使用 i18n:前缀的形式
|
Loading…
Reference in New Issue