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

fix: i18n errors #353

Merged
merged 1 commit into from
Feb 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/rhoas/pkged.go

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions locales/cmd/kafka/common/active.en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ one = 'could not set the current Kafka instance: {{.ErrorMessage}}'
description = 'Error message when no Kafka is set'
one = 'no Kafka instance is currently set, use the "--id" flag or set the current instance with the "rhoas kafka use" command'

[kafka.common.error.notFoundErrorById]
one = 'Kafka instance with ID "{{.ID}}" not found'

[kafka.common.flag.output.description]
description = "Description for --output flag"
one = 'Format in which to display the Kafka instance. Choose from: "json", "yml", "yaml"'
Expand Down
2 changes: 1 addition & 1 deletion locales/cmd/kafka/delete/active.en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ one = 'Confirm the name of the instance you want to delete:'

[kafka.delete.log.info.incorrectNameConfirmation]
description = 'Info message when user incorrectly confirms the name'
one = 'The name you entered does not match the name of the Kafka instance that you are trying to delete. Please check that it correct and try again.'
one = 'The name you entered does not match the name of the Kafka instance that you are trying to delete. Please check that it is correct and try again.'

[kafka.delete.log.debug.deletingKafka]
description = 'Debug message when deleting Kafka'
Expand Down
4 changes: 2 additions & 2 deletions locales/cmd/serviceaccount/reset-credentials/active.en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ one = 'Service account "{{.Name}}" created successfully with ID "{{.ID}}".'
[serviceAccount.resetCredentials.input.id.message]
one = "Service Account ID:"

[serviceAccount.resetCredentials.input.name.help]
[serviceAccount.resetCredentials.input.id.help]
description = 'help for the ID input'
one = "What is the ID of the service account?"

Expand All @@ -62,7 +62,7 @@ description = 'Help for credentials format input'
one = 'File format in which to save the service account credentials:'

[serviceAccount.resetCredentials.input.confirmReset.message]
one = 'Are you sure you want to reset the credentials for service account "{{.Name}}"?'
one = 'Are you sure you want to reset the credentials for service account "{{.ID}}"?'

[serviceAccount.resetCredentials.log.debug.cancelledReset]
one = 'You have chosen to not reset the service account credentials.'
Expand Down
6 changes: 5 additions & 1 deletion locales/kafka/active.en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@ Invalid Kafka instance name. Valid names must satisfy the following conditions:
'''

[kafka.validation.name.error.lengthError]
one = 'Kafka instance name must be between 1 and 32 characters'
one = 'Kafka instance name must be between 1 and 32 characters'


[kafka.common.error.notFoundErrorById]
one = 'Kafka instance with ID "{{.ID}}" not found'
7 changes: 6 additions & 1 deletion pkg/cmd/kafka/delete/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,12 @@ func runDelete(opts *options) error {

kafkaName := response.GetName()

logger.Info(localizer.MustLocalizeFromID("kafka.delete.log.info.deleting"), "\n")
logger.Info(localizer.MustLocalize(&localizer.Config{
MessageID: "kafka.delete.log.info.deleting",
TemplateData: map[string]interface{}{
"Name": kafkaName,
},
}), "\n")

if !opts.force {
promptConfirmName := &survey.Input{
Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/kafka/kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package kafka

import (
// "github.com/bf2fc6cc711aee1a0c2a/cli/pkg/cmd/kafka/topic"
"github.com/spf13/cobra"

"github.com/bf2fc6cc711aee1a0c2a/cli/internal/localizer"
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/kafka/topic/topic.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package topics
package topic

import (
"github.com/bf2fc6cc711aee1a0c2a/cli/internal/localizer"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func runResetCredentials(opts *Options) (err error) {
Message: localizer.MustLocalize(&localizer.Config{
MessageID: "serviceAccount.resetCredentials.input.confirmReset.message",
TemplateData: map[string]interface{}{
"Name": serviceAcctName,
"ID": opts.id,
},
}),
}
Expand Down
5 changes: 4 additions & 1 deletion pkg/kafka/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import (
"github.com/bf2fc6cc711aee1a0c2a/cli/internal/localizer"
)

func init() {
localizer.LoadMessageFiles("kafka")
}

type Error struct {
Err error
}
Expand All @@ -16,7 +20,6 @@ func (e *Error) Error() string {
}

func ErrorNotFound(id string) *Error {
localizer.LoadMessageFiles("kafka/common")
return &Error{
Err: errors.New(localizer.MustLocalize(&localizer.Config{
MessageID: "kafka.common.error.notFoundErrorById",
Expand Down