Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add i18n for Command Log #2848

Open
jesseduffield opened this issue Jul 30, 2023 · 3 comments
Open

Add i18n for Command Log #2848

jesseduffield opened this issue Jul 30, 2023 · 3 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@jesseduffield
Copy link
Owner

We need to internationalise the strings we pass to the LogCommand function. Due to an oversight, these are all hard-coded at the moment:

image

Here's an example of i18n'ing one of the instances:

diff --git a/pkg/commands/git_commands/rebase.go b/pkg/commands/git_commands/rebase.go
index 83c3fbe09..3ad7b7b32 100644
--- a/pkg/commands/git_commands/rebase.go
+++ b/pkg/commands/git_commands/rebase.go
@@ -149,7 +149,13 @@ func (self *RebaseCommands) InteractiveRebase(commits []*models.Commit, index in
 }
 
 func (self *RebaseCommands) EditRebase(branchRef string) error {
-	self.os.LogCommand(fmt.Sprintf("Beginning interactive rebase at '%s'", branchRef), false)
+	msg := utils.ResolvePlaceholderString(
+		self.Tr.Actions.BeginningInteractiveRebaseAtRef,
+		map[string]string{
+			"ref": branchRef,
+		},
+	)
+	self.os.LogCommand(msg, false)
 	return self.PrepareInteractiveRebaseCommand(PrepareInteractiveRebaseCommandOpts{
 		baseShaOrRoot: branchRef,
 		instruction:   daemon.NewInsertBreakInstruction(),
diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go
index ecfa6a2ae..e693f7715 100644
--- a/pkg/i18n/english.go
+++ b/pkg/i18n/english.go
@@ -710,6 +710,7 @@ type Actions struct {
 	BisectMark                        string
 	RemoveWorktree                    string
 	AddWorktree                       string
+	BeginningInteractiveRebaseAtRef   string
 }
 
 const englishIntroPopupMessage = `
@@ -1424,6 +1425,7 @@ func EnglishTranslationSet() TranslationSet {
 			BisectMark:                        "Bisect mark",
 			RemoveWorktree:                    "Remove worktree",
 			AddWorktree:                       "Add worktree",
+			BeginningInteractiveRebaseAtRef:   "Beginning interactive rebase at '{{.ref}}'",
 		},
 		Bisect: Bisect{
 			Mark:                        "Mark current commit (%s) as %s",
@jesseduffield jesseduffield added enhancement New feature or request good first issue Good for newcomers labels Jul 30, 2023
@KarlHeitmann
Copy link
Contributor

I want to do this one. Any thoughts on how to test it? Or it is not necessary: just move the code from hard coded to i18n file

@jesseduffield
Copy link
Owner Author

Sounds good @KarlHeitmann ! No need to worry about tests, I consider this copy stuff low-stakes

@topher200
Copy link

I think this issue can be closed -- it has been resolved by #2852

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants