Draft
Conversation
* Card ID - CCT-151 Signed-off-by: mjcr99 <macano@redhat.com> Assisted-By: Claude Code
m-horky
requested changes
Feb 27, 2026
cmd/rhc/canonical_facts_cmd.go
Outdated
| facts, err := canonical_facts.GetCanonicalFacts() | ||
| if err != nil { | ||
| return cli.Exit(fmt.Errorf("cannot generate canonical facts: %v", err), 1) | ||
| return cli.Exit(fmt.Errorf(localization.TF("cannot generate canonical facts: %v", err)), 1) |
Collaborator
There was a problem hiding this comment.
You can't be passing strings with variables already filled in, the string wouldn't match.
return cli.Exit(fmt.Errorf(localization.TF("cannot generate canonical facts: %v"), err), 1)
Collaborator
|
Also please unlink CCT-148 from this PR/commit(s), we're doing it separately. |
…its traslability * Card ID - CCT-151 Signed-off-by: mjcr99 <macano@redhat.com> Assisted-By: Claude Code
* Card ID - CCT-151 .pot file has been extracted using the following command: xgettext --keyword=T --keyword=TF --keyword=TN:1,2 --keyword=TNF:1,2 \ --keyword=TC:1c,2 --keyword=TCF:1c,2 \ -o po/rhc.pot $(find cmd internal -type f -name "*.go" ! -name "*test*") Signed-off-by: mjcr99 <macano@redhat.com>
* Card ID: CCT-151 After implementing localization support with go-gettext, the build was failing with "non-constant format string" errors. Go's static analysis tools (go vet) require format strings in functions like fmt.Errorf and fmt.Printf to be compile-time constants, but localization.TF() returns strings at runtime. This commit fixes the issue by adjusting how translated strings are used: - Replace fmt.Errorf(localization.TF(...)) with errors.New(localization.TF(...)) Since TF() already handles formatting via fmt.Sprintf internally, we don't need fmt.Errorf's formatting capabilities. Using errors.New with the pre-formatted string avoids the constant requirement. - Replace fmt.Printf(localization.TF(...)) with fmt.Print(localization.TF(...)) Similarly, TF() returns an already-formatted string, so we use Print instead of Printf to avoid the format string validation. - Replace ui.Printf(localization.TF(...)) with ui.Printf("%s", localization.TF(...)) Add an explicit format specifier to satisfy the constant requirement. This approach is minimally invasive and preserves the T(), TF(), TN(), and other localization function signatures unchanged, ensuring that xgettext-based .pot file extraction continues to work correctly. Signed-off-by: mjcr99 <macano@redhat.com> Assisted-By: Claude Code
0794e0b to
8c6aabf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Hi team, this PR implements the required changes to fully support localization, following are the key aspects covered:
snapcore/go-gettexthas been chosen to implement the localization support.rhc.potfile.rhc.potfile has been added.