Replace verbose map-based translation calls with concise grammar
engine helpers across all command packages:
- i18n.T("common.label.xxx") → i18n.Label("xxx")
- i18n.T("common.error.failed", map) → i18n.T("i18n.fail.verb", subj)
- i18n.T("common.progress.running", map) → i18n.ProgressSubject()
- i18n.T("common.count.xxx", map) → i18n.T("i18n.count.xxx", n)
Packages updated: ai, ci, dev, docs, php, pkgcmd, sdk, setup, test, vm
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
32 lines
770 B
Go
32 lines
770 B
Go
package ci
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/host-uk/core/pkg/i18n"
|
|
"github.com/host-uk/core/pkg/release"
|
|
)
|
|
|
|
// runChangelog generates and prints a changelog.
|
|
func runChangelog(fromRef, toRef string) error {
|
|
projectDir, err := os.Getwd()
|
|
if err != nil {
|
|
return fmt.Errorf("%s: %w", i18n.T("i18n.fail.get", "working directory"), err)
|
|
}
|
|
|
|
// Load config for changelog settings
|
|
cfg, err := release.LoadConfig(projectDir)
|
|
if err != nil {
|
|
return fmt.Errorf("%s: %w", i18n.T("i18n.fail.load", "config"), err)
|
|
}
|
|
|
|
// Generate changelog
|
|
changelog, err := release.GenerateWithConfig(projectDir, fromRef, toRef, &cfg.Changelog)
|
|
if err != nil {
|
|
return fmt.Errorf("%s: %w", i18n.T("i18n.fail.generate", "changelog"), err)
|
|
}
|
|
|
|
fmt.Println(changelog)
|
|
return nil
|
|
}
|