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:
parent
ace7524905
commit
a76c2a8c22
15 changed files with 51 additions and 31 deletions
|
@ -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}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue