i18n

package
v0.0.0-...-75026ef Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2024 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package i18n provides translatable notification and error messages.

Copyright (c) 2018 - 2024 PhotoPrism UG. All rights reserved.

This program is free software: you can redistribute it and/or modify
it under Version 3 of the GNU Affero General Public License (the "AGPL"):
<https://docs.photoprism.app/license/agpl>

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

The AGPL is supplemented by our Trademark and Brand Guidelines,
which describe how our Brand Assets may be used:
<https://www.photoprism.app/trademark>

Feel free to send an email to hello@photoprism.app if you have questions, want to support our work, or just want to say hello.

Additional information can be found in our Developer Guide: <https://docs.photoprism.app/developer-guide/>

Index

Constants

This section is empty.

Variables

View Source
var Messages = MessageMap{

	ErrUnexpected:         gettext("Something went wrong, try again"),
	ErrBadRequest:         gettext("Unable to do that"),
	ErrSaveFailed:         gettext("Changes could not be saved"),
	ErrDeleteFailed:       gettext("Could not be deleted"),
	ErrAlreadyExists:      gettext("%s already exists"),
	ErrNotFound:           gettext("Not found"),
	ErrFileNotFound:       gettext("File not found"),
	ErrFileTooLarge:       gettext("File too large"),
	ErrUnsupported:        gettext("Unsupported"),
	ErrUnsupportedType:    gettext("Unsupported type"),
	ErrUnsupportedFormat:  gettext("Unsupported format"),
	ErrOriginalsEmpty:     gettext("Originals folder is empty"),
	ErrSelectionNotFound:  gettext("Selection not found"),
	ErrEntityNotFound:     gettext("Entity not found"),
	ErrAccountNotFound:    gettext("Account not found"),
	ErrUserNotFound:       gettext("User not found"),
	ErrLabelNotFound:      gettext("Label not found"),
	ErrAlbumNotFound:      gettext("Album not found"),
	ErrSubjectNotFound:    gettext("Subject not found"),
	ErrPersonNotFound:     gettext("Person not found"),
	ErrFaceNotFound:       gettext("Face not found"),
	ErrPublic:             gettext("Not available in public mode"),
	ErrReadOnly:           gettext("Not available in read-only mode"),
	ErrUnauthorized:       gettext("Please log in to your account"),
	ErrForbidden:          gettext("Permission denied"),
	ErrOffensiveUpload:    gettext("Upload might be offensive"),
	ErrUploadFailed:       gettext("Upload failed"),
	ErrNoItemsSelected:    gettext("No items selected"),
	ErrCreateFile:         gettext("Failed creating file, please check permissions"),
	ErrCreateFolder:       gettext("Failed creating folder, please check permissions"),
	ErrConnectionFailed:   gettext("Could not connect, please try again"),
	ErrPasscodeRequired:   gettext("Enter verification code"),
	ErrInvalidPasscode:    gettext("Invalid verification code, please try again"),
	ErrInvalidPassword:    gettext("Invalid password, please try again"),
	ErrFeatureDisabled:    gettext("Feature disabled"),
	ErrNoLabelsSelected:   gettext("No labels selected"),
	ErrNoAlbumsSelected:   gettext("No albums selected"),
	ErrNoFilesForDownload: gettext("No files available for download"),
	ErrZipFailed:          gettext("Failed to create zip file"),
	ErrInvalidCredentials: gettext("Invalid credentials"),
	ErrInvalidLink:        gettext("Invalid link"),
	ErrInvalidName:        gettext("Invalid name"),
	ErrBusy:               gettext("Busy, please try again later"),
	ErrWakeupInterval:     gettext("The wakeup interval is %s, but must be 1h or less"),
	ErrAccountConnect:     gettext("Your account could not be connected"),

	MsgChangesSaved:          gettext("Changes successfully saved"),
	MsgAlbumCreated:          gettext("Album created"),
	MsgAlbumSaved:            gettext("Album saved"),
	MsgAlbumDeleted:          gettext("Album %s deleted"),
	MsgAlbumCloned:           gettext("Album contents cloned"),
	MsgFileUnstacked:         gettext("File removed from stack"),
	MsgFileDeleted:           gettext("File deleted"),
	MsgSelectionAddedTo:      gettext("Selection added to %s"),
	MsgEntryAddedTo:          gettext("One entry added to %s"),
	MsgEntriesAddedTo:        gettext("%d entries added to %s"),
	MsgEntryRemovedFrom:      gettext("One entry removed from %s"),
	MsgEntriesRemovedFrom:    gettext("%d entries removed from %s"),
	MsgAccountCreated:        gettext("Account created"),
	MsgAccountSaved:          gettext("Account saved"),
	MsgAccountDeleted:        gettext("Account deleted"),
	MsgSettingsSaved:         gettext("Settings saved"),
	MsgPasswordChanged:       gettext("Password changed"),
	MsgImportCompletedIn:     gettext("Import completed in %d s"),
	MsgImportCanceled:        gettext("Import canceled"),
	MsgIndexingCompletedIn:   gettext("Indexing completed in %d s"),
	MsgIndexingOriginals:     gettext("Indexing originals..."),
	MsgIndexingFiles:         gettext("Indexing files in %s"),
	MsgIndexingCanceled:      gettext("Indexing canceled"),
	MsgRemovedFilesAndPhotos: gettext("Removed %d files and %d photos"),
	MsgMovingFilesFrom:       gettext("Moving files from %s"),
	MsgCopyingFilesFrom:      gettext("Copying files from %s"),
	MsgLabelsDeleted:         gettext("Labels deleted"),
	MsgLabelSaved:            gettext("Label saved"),
	MsgSubjectSaved:          gettext("Subject saved"),
	MsgSubjectDeleted:        gettext("Subject deleted"),
	MsgPersonSaved:           gettext("Person saved"),
	MsgPersonDeleted:         gettext("Person deleted"),
	MsgFileUploaded:          gettext("File uploaded"),
	MsgFilesUploadedIn:       gettext("%d files uploaded in %d s"),
	MsgProcessingUpload:      gettext("Processing upload..."),
	MsgUploadProcessed:       gettext("Upload has been processed"),
	MsgSelectionApproved:     gettext("Selection approved"),
	MsgSelectionArchived:     gettext("Selection archived"),
	MsgSelectionRestored:     gettext("Selection restored"),
	MsgSelectionProtected:    gettext("Selection marked as private"),
	MsgAlbumsDeleted:         gettext("Albums deleted"),
	MsgZipCreatedIn:          gettext("Zip created in %d s"),
	MsgPermanentlyDeleted:    gettext("Permanently deleted"),
	MsgRestored:              gettext("%s has been restored"),
	MsgVerified:              gettext("Successfully verified"),
	MsgActivated:             gettext("Successfully activated"),
}

Functions

func Error

func Error(id Message, params ...interface{}) error

Error returns a translated error message.

func Lower

func Lower(id Message, params ...interface{}) string

Lower returns the untranslated message as a lowercase string for use in logs.

func Msg

func Msg(id Message, params ...interface{}) string

Msg returns a translated message string.

func SetDir

func SetDir(dir string)

func SetLocale

func SetLocale(loc string)

Types

type Locale

type Locale string
const (
	German              Locale = "de"
	English             Locale = "en"
	Spanish             Locale = "es"
	French              Locale = "fr"
	Dutch               Locale = "nl"
	Polish              Locale = "pl"
	Portuguese          Locale = "pt"
	BrazilianPortuguese Locale = "pt_BR"
	Russian             Locale = "ru"
	ChineseSimplified   Locale = "zh"
	ChineseTraditional  Locale = "zh_TW"
	Default                    = English
)

func (Locale) Locale

func (l Locale) Locale() string

type Message

type Message int
const (
	ErrUnexpected Message = iota + 1
	ErrBadRequest
	ErrSaveFailed
	ErrDeleteFailed
	ErrAlreadyExists
	ErrNotFound
	ErrFileNotFound
	ErrFileTooLarge
	ErrUnsupported
	ErrUnsupportedType
	ErrUnsupportedFormat
	ErrOriginalsEmpty
	ErrSelectionNotFound
	ErrEntityNotFound
	ErrAccountNotFound
	ErrUserNotFound
	ErrLabelNotFound
	ErrAlbumNotFound
	ErrSubjectNotFound
	ErrPersonNotFound
	ErrFaceNotFound
	ErrPublic
	ErrReadOnly
	ErrUnauthorized
	ErrForbidden
	ErrOffensiveUpload
	ErrUploadFailed
	ErrNoItemsSelected
	ErrCreateFile
	ErrCreateFolder
	ErrConnectionFailed
	ErrPasscodeRequired
	ErrInvalidPasscode
	ErrInvalidPassword
	ErrFeatureDisabled
	ErrNoLabelsSelected
	ErrNoAlbumsSelected
	ErrNoFilesForDownload
	ErrZipFailed
	ErrInvalidCredentials
	ErrInvalidLink
	ErrInvalidName
	ErrBusy
	ErrWakeupInterval
	ErrAccountConnect

	MsgChangesSaved
	MsgAlbumCreated
	MsgAlbumSaved
	MsgAlbumDeleted
	MsgAlbumCloned
	MsgFileUnstacked
	MsgFileDeleted
	MsgSelectionAddedTo
	MsgEntryAddedTo
	MsgEntriesAddedTo
	MsgEntryRemovedFrom
	MsgEntriesRemovedFrom
	MsgAccountCreated
	MsgAccountSaved
	MsgAccountDeleted
	MsgSettingsSaved
	MsgPasswordChanged
	MsgImportCompletedIn
	MsgImportCanceled
	MsgIndexingCompletedIn
	MsgIndexingOriginals
	MsgIndexingFiles
	MsgIndexingCanceled
	MsgRemovedFilesAndPhotos
	MsgMovingFilesFrom
	MsgCopyingFilesFrom
	MsgLabelsDeleted
	MsgLabelSaved
	MsgSubjectSaved
	MsgSubjectDeleted
	MsgPersonSaved
	MsgPersonDeleted
	MsgFileUploaded
	MsgFilesUploadedIn
	MsgProcessingUpload
	MsgUploadProcessed
	MsgSelectionApproved
	MsgSelectionArchived
	MsgSelectionRestored
	MsgSelectionProtected
	MsgAlbumsDeleted
	MsgZipCreatedIn
	MsgPermanentlyDeleted
	MsgRestored
	MsgVerified
	MsgActivated
)

type MessageMap

type MessageMap map[Message]string

type Response

type Response struct {
	Code    int    `json:"code"`
	Err     string `json:"error,omitempty"`
	Msg     string `json:"message,omitempty"`
	Details string `json:"details,omitempty"`
}

func NewResponse

func NewResponse(code int, id Message, params ...interface{}) Response

func (Response) Error

func (r Response) Error() string

func (Response) LowerString

func (r Response) LowerString() string

func (Response) String

func (r Response) String() string

func (Response) Success

func (r Response) Success() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL