Skip to content

Commit

Permalink
ref(locale): use go-i18n.Message directly instead of extendio (#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
plastikfan committed Oct 9, 2024
1 parent 2eb2453 commit ea28b04
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 12 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"nakedret",
"natefinch",
"navi",
"nicksnyder",
"nolint",
"nolintlint",
"nosec",
Expand Down
13 changes: 7 additions & 6 deletions src/locale/messages-command-errors.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package locale

import (
"github.com/nicksnyder/go-i18n/v2/i18n"
xi18n "github.com/snivilised/extendio/i18n"
)

Expand All @@ -12,8 +13,8 @@ type ShrinkCmdSamplingFactorInvalidTemplData struct {
Acceptable string
}

func (td ShrinkCmdSamplingFactorInvalidTemplData) Message() *xi18n.Message {
return &xi18n.Message{
func (td ShrinkCmdSamplingFactorInvalidTemplData) Message() *i18n.Message {
return &i18n.Message{
ID: "shrink-cmd-sampling-factor-invalid.error",
Description: "shrink command sampling factor failed validation",
Other: "invalid sampling factor value: {{.Value}}, acceptable: {{.Acceptable}}",
Expand Down Expand Up @@ -49,8 +50,8 @@ type ShrinkCmdInterlaceInvalidTemplData struct {
Acceptable string
}

func (td ShrinkCmdInterlaceInvalidTemplData) Message() *xi18n.Message {
return &xi18n.Message{
func (td ShrinkCmdInterlaceInvalidTemplData) Message() *i18n.Message {
return &i18n.Message{
ID: "shrink-cmd-interlace-invalid.error",
Description: "shrink command interlace failed validation",
Other: "invalid interlace value: {{.Value}}, acceptable: {{.Acceptable}}",
Expand Down Expand Up @@ -85,8 +86,8 @@ type ShrinkCmdOutputPathDoesNotExistTemplData struct {
Path string
}

func (td ShrinkCmdOutputPathDoesNotExistTemplData) Message() *xi18n.Message {
return &xi18n.Message{
func (td ShrinkCmdOutputPathDoesNotExistTemplData) Message() *i18n.Message {
return &i18n.Message{
ID: "shrink-cmd-output-path-does-not-exist.error",
Description: "shrink command mirror path does not exist validation",
Other: "output path: {{.Path}}, does not exist",
Expand Down
2 changes: 1 addition & 1 deletion src/locale/messages-command.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package locale

import (
"github.com/snivilised/extendio/i18n"
"github.com/nicksnyder/go-i18n/v2/i18n"
)

// ⚠️ for the usage definitions, make sure that the first token inside the "Other"
Expand Down
7 changes: 4 additions & 3 deletions src/locale/messages-errors.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package locale

import (
i18n "github.com/snivilised/extendio/i18n"
i18n "github.com/nicksnyder/go-i18n/v2/i18n"
xi18n "github.com/snivilised/extendio/i18n"
)

// ❌ FooBar
Expand Down Expand Up @@ -34,7 +35,7 @@ type FooBarErrorBehaviourQuery interface {
}

type FooBarError struct {
i18n.LocalisableError
xi18n.LocalisableError
}

// FooBar enables the client to check if error is FooBarError
Expand All @@ -46,7 +47,7 @@ func (e FooBarError) FooBar() bool {
// NewFooBarError creates a FooBarError
func NewFooBarError(path string, reason error) FooBarError {
return FooBarError{
LocalisableError: i18n.LocalisableError{
LocalisableError: xi18n.LocalisableError{
Data: FooBarTemplData{
Path: path,
Reason: reason,
Expand Down
2 changes: 1 addition & 1 deletion src/locale/messages-general.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package locale

import (
"github.com/snivilised/extendio/i18n"
"github.com/nicksnyder/go-i18n/v2/i18n"
)

type UsingConfigFileTemplData struct {
Expand Down
2 changes: 1 addition & 1 deletion src/locale/test-locale-messages_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package locale_test

import (
"github.com/snivilised/extendio/i18n"
"github.com/nicksnyder/go-i18n/v2/i18n"
)

const (
Expand Down

0 comments on commit ea28b04

Please sign in to comment.