From a86da6d01dc93621a9acdc6275a61ca805988215 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Mon, 17 Apr 2023 17:32:10 +0200 Subject: [PATCH] Fix the title and text (and variable names) of the Discard Changes prompt The title was saying "Unstage lines", which was just wrong. The text said "Delete lines", which can be seen as a bit misleading; we are only discarding the changes to the selected lines, not deleting the lines themselves. For consistency, rename the config variable skipUnstageLineWarning accordingly. --- docs/Config.md | 2 +- pkg/config/user_config.go | 24 ++++++++++---------- pkg/gui/controllers/staging_controller.go | 6 ++--- pkg/i18n/chinese.go | 4 ++-- pkg/i18n/english.go | 8 +++---- pkg/i18n/japanese.go | 4 ++-- pkg/i18n/korean.go | 4 ++-- pkg/i18n/traditional_chinese.go | 4 ++-- pkg/integration/components/common.go | 4 ++-- pkg/integration/tests/staging/stage_lines.go | 4 ++-- 10 files changed, 32 insertions(+), 32 deletions(-) diff --git a/docs/Config.md b/docs/Config.md index 938aaba299f..72155d647a7 100644 --- a/docs/Config.md +++ b/docs/Config.md @@ -53,7 +53,7 @@ gui: commitLength: show: true mouseEvents: true - skipUnstageLineWarning: false + skipDiscardChangeWarning: false skipStashWarning: false showFileTree: true # for rendering changes files in a tree format showListFooter: true # for seeing the '5 of 20' message in list panels diff --git a/pkg/config/user_config.go b/pkg/config/user_config.go index 597253e3d51..a516b606489 100644 --- a/pkg/config/user_config.go +++ b/pkg/config/user_config.go @@ -32,7 +32,7 @@ type GuiConfig struct { ScrollHeight int `yaml:"scrollHeight"` ScrollPastBottom bool `yaml:"scrollPastBottom"` MouseEvents bool `yaml:"mouseEvents"` - SkipUnstageLineWarning bool `yaml:"skipUnstageLineWarning"` + SkipDiscardChangeWarning bool `yaml:"skipUnstageLineWarning"` SkipStashWarning bool `yaml:"skipStashWarning"` SidePanelWidth float64 `yaml:"sidePanelWidth"` ExpandFocusedSidePanel bool `yaml:"expandFocusedSidePanel"` @@ -396,17 +396,17 @@ type CustomCommandMenuOption struct { func GetDefaultConfig() *UserConfig { return &UserConfig{ Gui: GuiConfig{ - ScrollHeight: 2, - ScrollPastBottom: true, - MouseEvents: true, - SkipUnstageLineWarning: false, - SkipStashWarning: false, - SidePanelWidth: 0.3333, - ExpandFocusedSidePanel: false, - MainPanelSplitMode: "flexible", - Language: "auto", - TimeFormat: "02 Jan 06", - ShortTimeFormat: time.Kitchen, + ScrollHeight: 2, + ScrollPastBottom: true, + MouseEvents: true, + SkipDiscardChangeWarning: false, + SkipStashWarning: false, + SidePanelWidth: 0.3333, + ExpandFocusedSidePanel: false, + MainPanelSplitMode: "flexible", + Language: "auto", + TimeFormat: "02 Jan 06", + ShortTimeFormat: time.Kitchen, Theme: ThemeConfig{ ActiveBorderColor: []string{"green", "bold"}, InactiveBorderColor: []string{"default"}, diff --git a/pkg/gui/controllers/staging_controller.go b/pkg/gui/controllers/staging_controller.go index 71b11cc065a..20a0ada672b 100644 --- a/pkg/gui/controllers/staging_controller.go +++ b/pkg/gui/controllers/staging_controller.go @@ -169,10 +169,10 @@ func (self *StagingController) ToggleStaged() error { func (self *StagingController) ResetSelection() error { reset := func() error { return self.applySelectionAndRefresh(true) } - if !self.staged && !self.c.UserConfig.Gui.SkipUnstageLineWarning { + if !self.staged && !self.c.UserConfig.Gui.SkipDiscardChangeWarning { return self.c.Confirm(types.ConfirmOpts{ - Title: self.c.Tr.UnstageLinesTitle, - Prompt: self.c.Tr.UnstageLinesPrompt, + Title: self.c.Tr.DiscardChangeTitle, + Prompt: self.c.Tr.DiscardChangePrompt, HandleConfirm: reset, }) } diff --git a/pkg/i18n/chinese.go b/pkg/i18n/chinese.go index 52e92559f35..179ed7a017b 100644 --- a/pkg/i18n/chinese.go +++ b/pkg/i18n/chinese.go @@ -378,8 +378,8 @@ func chineseTranslationSet() TranslationSet { NoFilesStagedPrompt: "您尚未暂存任何文件。提交所有文件?", BranchNotFoundTitle: "找不到分支", BranchNotFoundPrompt: "找不到分支。创建一个新分支命名为:", - UnstageLinesTitle: "取消暂存选中的行", - UnstageLinesPrompt: "您确定要删除所选的行(git reset)吗?这是不可逆的。\n要禁用此对话框,请将 'gui.skipUnstageLineWarning' 的配置键设置为 true", + DiscardChangeTitle: "取消暂存选中的行", + DiscardChangePrompt: "您确定要删除所选的行(git reset)吗?这是不可逆的。\n要禁用此对话框,请将 'gui.skipDiscardChangeWarning' 的配置键设置为 true", CreateNewBranchFromCommit: "从提交创建新分支", BuildingPatch: "正在构建补丁", ViewCommits: "查看提交", diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index 22a00b91c83..097bc2e58ad 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -424,8 +424,8 @@ type TranslationSet struct { BranchNotFoundTitle string BranchNotFoundPrompt string BranchUnknown string - UnstageLinesTitle string - UnstageLinesPrompt string + DiscardChangeTitle string + DiscardChangePrompt string CreateNewBranchFromCommit string BuildingPatch string ViewCommits string @@ -1111,8 +1111,8 @@ func EnglishTranslationSet() TranslationSet { BranchNotFoundTitle: "Branch not found", BranchNotFoundPrompt: "Branch not found. Create a new branch named", BranchUnknown: "Branch unknown", - UnstageLinesTitle: "Unstage lines", - UnstageLinesPrompt: "Are you sure you want to delete the selected lines (git reset)? It is irreversible.\nTo disable this dialogue set the config key of 'gui.skipUnstageLineWarning' to true", + DiscardChangeTitle: "Discard change", + DiscardChangePrompt: "Are you sure you want to discard this change (git reset)? It is irreversible.\nTo disable this dialogue set the config key of 'gui.skipDiscardChangeWarning' to true", CreateNewBranchFromCommit: "Create new branch off of commit", BuildingPatch: "Building patch", ViewCommits: "View commits", diff --git a/pkg/i18n/japanese.go b/pkg/i18n/japanese.go index 49941f6c078..6713bf4fb52 100644 --- a/pkg/i18n/japanese.go +++ b/pkg/i18n/japanese.go @@ -394,8 +394,8 @@ func japaneseTranslationSet() TranslationSet { NoFilesStagedPrompt: "ファイルがステージされていません。すべての変更をコミットしますか?", BranchNotFoundTitle: "ブランチが見つかりませんでした。", BranchNotFoundPrompt: "ブランチが見つかりませんでした。新しくブランチを作成します ", - UnstageLinesTitle: "選択行をアンステージ", - UnstageLinesPrompt: "選択された行を削除 (git reset) します。よろしいですか? この操作は取り消せません。\nこの警告を無効化するには設定ファイルの 'gui.skipUnstageLineWarning' を true に設定してください。", + DiscardChangeTitle: "選択行をアンステージ", + DiscardChangePrompt: "選択された行を削除 (git reset) します。よろしいですか? この操作は取り消せません。\nこの警告を無効化するには設定ファイルの 'gui.skipDiscardChangeWarning' を true に設定してください。", CreateNewBranchFromCommit: "コミットにブランチを作成", BuildingPatch: "パッチを構築", ViewCommits: "コミットを閲覧", diff --git a/pkg/i18n/korean.go b/pkg/i18n/korean.go index 1c469ed68b0..ea4446d2435 100644 --- a/pkg/i18n/korean.go +++ b/pkg/i18n/korean.go @@ -389,8 +389,8 @@ func koreanTranslationSet() TranslationSet { NoFilesStagedPrompt: "파일이 Staged 되지 않았습니다. 모든 파일을 커밋하시겠습니까?", BranchNotFoundTitle: "브랜치를 찾을 수 없습니다.", BranchNotFoundPrompt: "브랜치를 찾을 수 없습니다. 새로운 브랜치를 생성합니다.", - UnstageLinesTitle: "선택한 라인을 unstaged", - UnstageLinesPrompt: "정말로 선택한 라인을 삭제 (git reset) 하시겠습니까? 이 조작은 취소할 수 없습니다.\n이 경고를 비활성화 하려면 설정 파일의 'gui.skipUnstageLineWarning' 를 true로 설정하세요.", + DiscardChangeTitle: "선택한 라인을 unstaged", + DiscardChangePrompt: "정말로 선택한 라인을 삭제 (git reset) 하시겠습니까? 이 조작은 취소할 수 없습니다.\n이 경고를 비활성화 하려면 설정 파일의 'gui.skipDiscardChangeWarning' 를 true로 설정하세요.", CreateNewBranchFromCommit: "커밋에서 새 브랜치를 만듭니다.", BuildingPatch: "Building patch", ViewCommits: "커밋 보기", diff --git a/pkg/i18n/traditional_chinese.go b/pkg/i18n/traditional_chinese.go index c51ae97b119..bfcca1c1b9a 100644 --- a/pkg/i18n/traditional_chinese.go +++ b/pkg/i18n/traditional_chinese.go @@ -481,8 +481,8 @@ func traditionalChineseTranslationSet() TranslationSet { BranchNotFoundTitle: "找不到分支", BranchNotFoundPrompt: "找不到分支。是否創建一個名為", BranchUnknown: "分支未知", - UnstageLinesTitle: "取消預存行", - UnstageLinesPrompt: "你確定要刪除所選行嗎(git reset)?此操作是不可逆的。\n要禁用此對話框,請將“gui.skipUnstageLineWarning”設置為true。", + DiscardChangeTitle: "取消預存行", + DiscardChangePrompt: "你確定要刪除所選行嗎(git reset)?此操作是不可逆的。\n要禁用此對話框,請將“gui.skipDiscardChangeWarning”設置為true。", CreateNewBranchFromCommit: "從提交建立新分支", BuildingPatch: "正在建立補丁", ViewCommits: "檢視提交", diff --git a/pkg/integration/components/common.go b/pkg/integration/components/common.go index 904c7371138..12afaee2faf 100644 --- a/pkg/integration/components/common.go +++ b/pkg/integration/components/common.go @@ -34,8 +34,8 @@ func (self *Common) ContinueOnConflictsResolved() { func (self *Common) ConfirmDiscardLines() { self.t.ExpectPopup().Confirmation(). - Title(Equals("Unstage lines")). - Content(Contains("Are you sure you want to delete the selected lines")). + Title(Equals("Discard change")). + Content(Contains("Are you sure you want to discard this change")). Confirm() } diff --git a/pkg/integration/tests/staging/stage_lines.go b/pkg/integration/tests/staging/stage_lines.go index 197e003cabd..5df7b23d42f 100644 --- a/pkg/integration/tests/staging/stage_lines.go +++ b/pkg/integration/tests/staging/stage_lines.go @@ -92,8 +92,8 @@ var StageLines = NewIntegrationTest(NewIntegrationTestArgs{ Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup().Confirmation(). - Title(Equals("Unstage lines")). - Content(Contains("Are you sure you want to delete the selected lines")). + Title(Equals("Discard change")). + Content(Contains("Are you sure you want to discard this change")). Confirm() }). IsEmpty()