1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-06-27 16:36:00 +00:00

Improve OPML import/export

This commit is contained in:
Frédéric Guillot 2017-11-20 14:35:11 -08:00
parent ace7524905
commit a76c2a8c22
15 changed files with 51 additions and 31 deletions

View file

@ -6,22 +6,27 @@ package errors
import (
"fmt"
"github.com/miniflux/miniflux2/locale"
)
// LocalizedError represents an error than could be translated to another language.
type LocalizedError struct {
message string
args []interface{}
}
// Error returns untranslated error message.
func (l LocalizedError) Error() string {
return fmt.Sprintf(l.message, l.args...)
}
// Localize returns the translated error message.
func (l LocalizedError) Localize(translation *locale.Language) string {
return translation.Get(l.message, l.args...)
}
// NewLocalizedError returns a new LocalizedError.
func NewLocalizedError(message string, args ...interface{}) LocalizedError {
return LocalizedError{message: message, args: args}
}