Skip to content

Commit

Permalink
Merge pull request #2933 from ActiveState/mitchell/dx-2352
Browse files Browse the repository at this point in the history
Propagate `locale.Tl()` to `locale.Tr()` changes.
  • Loading branch information
MDrakos authored Dec 6, 2023
2 parents 0ef43d9 + ed582d3 commit 26eb70c
Show file tree
Hide file tree
Showing 26 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion cmd/state/autoupdate.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func autoUpdate(svc *model.SvcModel, args []string, cfg *config.Instance, an ana
return false, nil // ignore
}
if os.IsPermission(err) {
return false, locale.WrapInputError(err, locale.Tl("auto_update_permission_err", "", constants.DocumentationURL, errs.JoinMessage(err)))
return false, locale.WrapInputError(err, locale.Tr("auto_update_permission_err", constants.DocumentationURL, errs.JoinMessage(err)))
}
return false, locale.WrapError(err, locale.T("auto_update_failed"))
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/state/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ func run(args []string, isInteractive bool, cfg *config.Instance, out output.Out
(pj.VersionBranch() != "" && pj.VersionBranch() != constants.BranchName) {
return errs.AddTips(
locale.NewInputError("lock_version_mismatch", "", pj.Source().Lock, constants.BranchName, constants.Version),
locale.Tl("lock_update_legacy_version", "", constants.DocumentationURLLocking),
locale.Tr("lock_update_legacy_version", constants.DocumentationURLLocking),
locale.T("lock_update_lock"),
)
}
Expand Down
6 changes: 3 additions & 3 deletions internal/runbits/requirements/requirements.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func (r *RequirementOperation) ExecuteRequirementOperation(requirementName, requ
if r.Project.IsHeadless() {
return rationalize.ErrHeadless
}
out.Notice(locale.Tl("operating_message", "", r.Project.NamespaceString(), r.Project.Dir()))
out.Notice(locale.Tr("operating_message", r.Project.NamespaceString(), r.Project.Dir()))

switch nsType {
case model.NamespacePackage, model.NamespaceBundle:
Expand All @@ -130,7 +130,7 @@ func (r *RequirementOperation) ExecuteRequirementOperation(requirementName, requ

var validatePkg = operation == bpModel.OperationAdded && (ns.Type() == model.NamespacePackage || ns.Type() == model.NamespaceBundle)
if !ns.IsValid() && (nsType == model.NamespacePackage || nsType == model.NamespaceBundle) {
pg = output.StartSpinner(out, locale.Tl("progress_pkg_nolang", "", requirementName), constants.TerminalAnimationInterval)
pg = output.StartSpinner(out, locale.Tr("progress_pkg_nolang", requirementName), constants.TerminalAnimationInterval)

supported, err := model.FetchSupportedLanguages(model.HostPlatform)
if err != nil {
Expand All @@ -157,7 +157,7 @@ func (r *RequirementOperation) ExecuteRequirementOperation(requirementName, requ

origRequirementName := requirementName
if validatePkg {
pg = output.StartSpinner(out, locale.Tl("progress_search", "", requirementName), constants.TerminalAnimationInterval)
pg = output.StartSpinner(out, locale.Tr("progress_search", requirementName), constants.TerminalAnimationInterval)

normalized, err := model.FetchNormalizedName(ns, requirementName)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/runners/checkout/checkout.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (u *Checkout) Run(params *Params) (rerr error) {

execDir := setup.ExecDir(rti.Target().Dir())
u.out.Print(output.Prepare(
locale.Tl("checkout_project_statement", "", proj.NamespaceString(), proj.Dir(), execDir),
locale.Tr("checkout_project_statement", proj.NamespaceString(), proj.Dir(), execDir),
&struct {
Namespace string `json:"namespace"`
Path string `json:"path"`
Expand Down
2 changes: 1 addition & 1 deletion internal/runners/cve/cve.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (c *Cve) Run() error {
if c.proj == nil {
return locale.NewError("cve_no_project", "No project found at the current directory.")
}
c.out.Notice(locale.Tl("operating_message", "", c.proj.NamespaceString(), c.proj.Dir()))
c.out.Notice(locale.Tr("operating_message", c.proj.NamespaceString(), c.proj.Dir()))

if !c.auth.Authenticated() {
return errs.AddTips(
Expand Down
2 changes: 1 addition & 1 deletion internal/runners/events/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (e *Events) Run() error {
if e.project == nil {
return locale.NewInputError("err_events_noproject", "You have to be inside a project folder to be able to view its events. Project folders contain an activestate.yaml.")
}
e.out.Notice(locale.Tl("operating_message", "", e.project.NamespaceString(), e.project.Dir()))
e.out.Notice(locale.Tr("operating_message", e.project.NamespaceString(), e.project.Dir()))

events := e.project.Events()
rows := make([]eventOutput, len(events))
Expand Down
2 changes: 1 addition & 1 deletion internal/runners/exec/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (s *Exec) Run(params *Params, args ...string) (rerr error) {
rtTarget = target.NewProjectTarget(proj, nil, trigger)
}

s.out.Notice(locale.Tl("operating_message", "", projectNamespace, projectDir))
s.out.Notice(locale.Tr("operating_message", projectNamespace, projectDir))

rt, err := runtime.New(rtTarget, s.analytics, s.svcModel, s.auth)
switch {
Expand Down
2 changes: 1 addition & 1 deletion internal/runners/export/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (e *Env) Run() error {
return locale.NewInputError("err_env_no_project", "No project found.")
}

e.out.Notice(locale.Tl("export_project_statement", "",
e.out.Notice(locale.Tr("export_project_statement",
e.project.NamespaceString(),
e.project.Dir()),
)
Expand Down
2 changes: 1 addition & 1 deletion internal/runners/history/history.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func (h *History) Run(params *HistoryParams) error {
if h.project == nil {
return locale.NewInputError("err_history_no_project", "No project found. Please run this command in a project directory")
}
h.out.Notice(locale.Tl("operating_message", "", h.project.NamespaceString(), h.project.Dir()))
h.out.Notice(locale.Tr("operating_message", h.project.NamespaceString(), h.project.Dir()))

localCommitID, err := commitmediator.Get(h.project)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/runners/packages/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (i *Import) Run(params *ImportRunParams) error {
return locale.NewInputError("err_no_project")
}

i.out.Notice(locale.Tl("operating_message", "", i.proj.NamespaceString(), i.proj.Dir()))
i.out.Notice(locale.Tr("operating_message", i.proj.NamespaceString(), i.proj.Dir()))

if params.FileName == "" {
params.FileName = defaultImportFile
Expand Down
2 changes: 1 addition & 1 deletion internal/runners/packages/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (l *List) Run(params ListRunParams, nstype model.NamespaceType) error {
logging.Debug("ExecuteList")

if l.project != nil && params.Project == "" {
l.out.Notice(locale.Tl("operating_message", "", l.project.NamespaceString(), l.project.Dir()))
l.out.Notice(locale.Tr("operating_message", l.project.NamespaceString(), l.project.Dir()))
}

var commit *strfmt.UUID
Expand Down
2 changes: 1 addition & 1 deletion internal/runners/pull/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (p *Pull) Run(params *PullParams) (rerr error) {
if p.project == nil {
return locale.NewInputError("err_no_project")
}
p.out.Notice(locale.Tl("operating_message", "", p.project.NamespaceString(), p.project.Dir()))
p.out.Notice(locale.Tr("operating_message", p.project.NamespaceString(), p.project.Dir()))

if p.project.IsHeadless() {
return locale.NewInputError("err_pull_headless", "You must first create a project. Please visit {{.V0}} to create your project.", p.project.URL())
Expand Down
2 changes: 1 addition & 1 deletion internal/runners/push/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (r *Push) Run(params PushParams) (rerr error) {
if err := r.verifyInput(); err != nil {
return errs.Wrap(err, "verifyInput failed")
}
r.out.Notice(locale.Tl("operating_message", "", r.project.NamespaceString(), r.project.Dir()))
r.out.Notice(locale.Tr("operating_message", r.project.NamespaceString(), r.project.Dir()))

commitID, err := commitmediator.Get(r.project) // The commit we want to push
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/runners/refresh/refresh.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (r *Refresh) Run(params *Params) error {

execDir := setup.ExecDir(rti.Target().Dir())
r.out.Print(output.Prepare(
locale.Tl("refresh_project_statement", "", proj.NamespaceString(), proj.Dir(), execDir),
locale.Tr("refresh_project_statement", proj.NamespaceString(), proj.Dir(), execDir),
&struct {
Namespace string `json:"namespace"`
Path string `json:"path"`
Expand Down
2 changes: 1 addition & 1 deletion internal/runners/reset/reset.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (r *Reset) Run(params *Params) error {
if r.project == nil {
return locale.NewInputError("err_no_project")
}
r.out.Notice(locale.Tl("operating_message", "", r.project.NamespaceString(), r.project.Dir()))
r.out.Notice(locale.Tr("operating_message", r.project.NamespaceString(), r.project.Dir()))

var commitID strfmt.UUID
if params.CommitID == "" {
Expand Down
2 changes: 1 addition & 1 deletion internal/runners/revert/revert.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (r *Revert) Run(params *Params) (rerr error) {
if params.CommitID == latestCommit.String() && params.To {
return locale.NewInputError("err_revert_to_current_commit", "The commit to revert to cannot be the latest commit")
}
r.out.Notice(locale.Tl("operating_message", "", r.project.NamespaceString(), r.project.Dir()))
r.out.Notice(locale.Tr("operating_message", r.project.NamespaceString(), r.project.Dir()))

bp := model.NewBuildPlannerModel(r.auth)
targetCommitID := params.CommitID // the commit to revert the contents of, or the commit to revert to
Expand Down
2 changes: 1 addition & 1 deletion internal/runners/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (r *Run) Run(name string, args []string) error {

checker.RunUpdateNotifier(r.analytics, r.svcModel, r.out)

r.out.Notice(locale.Tl("operating_message", "", r.proj.NamespaceString(), r.proj.Dir()))
r.out.Notice(locale.Tr("operating_message", r.proj.NamespaceString(), r.proj.Dir()))

if name == "" {
return locale.NewError("error_state_run_undefined_name")
Expand Down
2 changes: 1 addition & 1 deletion internal/runners/scripts/scripts.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (s *Scripts) Run() error {
if s.project == nil {
return locale.NewInputError("err_no_project")
}
s.output.Notice(locale.Tl("operating_message", "", s.project.NamespaceString(), s.project.Dir()))
s.output.Notice(locale.Tr("operating_message", s.project.NamespaceString(), s.project.Dir()))

name, owner := s.project.Name(), s.project.Owner()
logging.Debug("listing scripts for org=%s, project=%s", owner, name)
Expand Down
2 changes: 1 addition & 1 deletion internal/runners/secrets/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func NewGet(p getPrimeable) *Get {

// Run executes the get behavior.
func (g *Get) Run(params GetRunParams) error {
g.out.Notice(locale.Tl("operating_message", "", g.proj.NamespaceString(), g.proj.Dir()))
g.out.Notice(locale.Tr("operating_message", g.proj.NamespaceString(), g.proj.Dir()))
if err := checkSecretsAccess(g.proj, g.auth); err != nil {
return locale.WrapError(err, "secrets_err_check_access")
}
Expand Down
2 changes: 1 addition & 1 deletion internal/runners/secrets/secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func (l *List) Run(params ListRunParams) error {
if l.proj == nil {
return locale.NewInputError("err_no_project")
}
l.out.Notice(locale.Tl("operating_message", "", l.proj.NamespaceString(), l.proj.Dir()))
l.out.Notice(locale.Tr("operating_message", l.proj.NamespaceString(), l.proj.Dir()))

if err := checkSecretsAccess(l.proj, l.auth); err != nil {
return locale.WrapError(err, "secrets_err_check_access")
Expand Down
2 changes: 1 addition & 1 deletion internal/runners/secrets/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func NewSet(p setPrimeable) *Set {

// Run executes the set behavior.
func (s *Set) Run(params SetRunParams) error {
s.out.Notice(locale.Tl("operating_message", "", s.proj.NamespaceString(), s.proj.Dir()))
s.out.Notice(locale.Tr("operating_message", s.proj.NamespaceString(), s.proj.Dir()))
if err := checkSecretsAccess(s.proj, s.auth); err != nil {
return locale.WrapError(err, "secrets_err_check_access")
}
Expand Down
2 changes: 1 addition & 1 deletion internal/runners/secrets/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func NewSync(client *secretsapi.Client, p syncPrimeable) *Sync {

// Run executes the sync behavior.
func (s *Sync) Run() error {
s.out.Notice(locale.Tl("operating_message", "", s.proj.NamespaceString(), s.proj.Dir()))
s.out.Notice(locale.Tr("operating_message", s.proj.NamespaceString(), s.proj.Dir()))
if err := checkSecretsAccess(s.proj, s.auth); err != nil {
return locale.WrapError(err, "secrets_err_check_access")
}
Expand Down
2 changes: 1 addition & 1 deletion internal/runners/shell/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (u *Shell) Run(params *Params) error {
return locale.NewInputError("err_shell_already_active", "", activatedProjectNamespace, activatedProjectDir)
}

u.out.Notice(locale.Tl("shell_project_statement", "",
u.out.Notice(locale.Tr("shell_project_statement",
proj.NamespaceString(),
proj.Dir(),
setup.ExecDir(rti.Target().Dir()),
Expand Down
2 changes: 1 addition & 1 deletion internal/runners/swtch/switch.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (s *Switch) Run(params SwitchParams) error {
if s.project == nil {
return locale.NewInputError("err_no_project")
}
s.out.Notice(locale.Tl("operating_message", "", s.project.NamespaceString(), s.project.Dir()))
s.out.Notice(locale.Tr("operating_message", s.project.NamespaceString(), s.project.Dir()))

project, err := model.LegacyFetchProjectByName(s.project.Owner(), s.project.Name())
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/runners/use/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (s *Show) Run() error {
executables := setup.ExecDir(projectTarget.Dir())

s.out.Print(output.Prepare(
locale.Tl("use_show_project_statement", "",
locale.Tr("use_show_project_statement",
proj.NamespaceString(),
projectDir,
executables,
Expand Down
2 changes: 1 addition & 1 deletion internal/runners/use/use.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (u *Use) Run(params *Params) error {

execDir := setup.ExecDir(rti.Target().Dir())
u.out.Print(output.Prepare(
locale.Tl("use_project_statement", "", proj.NamespaceString(), proj.Dir(), execDir),
locale.Tr("use_project_statement", proj.NamespaceString(), proj.Dir(), execDir),
&struct {
Namespace string `json:"namespace"`
Path string `json:"path"`
Expand Down

0 comments on commit 26eb70c

Please sign in to comment.