locales

package
v0.5.12 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const Tag feature.Tag = "fs-editor-locales"

Variables

View Source
var (
	DefaultEditorType = "locale"
	DefaultEditorKey  = "locales"
)

Functions

func ConvertFromPlaceholders added in v0.5.1

func ConvertFromPlaceholders(translation string, placeholders []*lang.Placeholder) (modified string)

func ConvertToPlaceholders added in v0.5.1

func ConvertToPlaceholders(translation string, placeholders []*lang.Placeholder) (modified string)

Types

type CFeature

type CFeature struct {
	fs_editor.CEditorFeature[MakeFeature]

	ViewLocaleAction feature.Action
}

func (*CFeature) DeleteDraftLocales

func (f *CFeature) DeleteDraftLocales(mountPoints feature.MountPoints)

func (*CFeature) EditorMenu

func (f *CFeature) EditorMenu(r *http.Request) (m menu.Menu)

func (*CFeature) FindFS

func (f *CFeature) FindFS(fsid string) (found feature.FileSystemFeature)

func (*CFeature) FindMountPoints

func (f *CFeature) FindMountPoints(fsid, code string) (mountPoints feature.MountPoints)

func (*CFeature) FindMountedPoints

func (f *CFeature) FindMountedPoints(fsid string) (mp feature.MountedPoints)

func (*CFeature) HasDraftLocales

func (f *CFeature) HasDraftLocales(fsid, code string) (present bool)

func (*CFeature) Init

func (f *CFeature) Init(this interface{})

func (*CFeature) IsLocaleLocked

func (f *CFeature) IsLocaleLocked(fsid, code string) (locked bool, eid string, err error)

func (*CFeature) ListLocaleFileSystemLocales

func (f *CFeature) ListLocaleFileSystemLocales(r *http.Request, fsid string) (list editor.Files)

func (*CFeature) ListLocaleFileSystems

func (f *CFeature) ListLocaleFileSystems(r *http.Request) (list editor.Files)

func (*CFeature) ListLocales

func (f *CFeature) ListLocales(r *http.Request) (list editor.Files)

func (*CFeature) LockLocale

func (f *CFeature) LockLocale(eid, fsid, code string) (err error)

func (*CFeature) Make

func (f *CFeature) Make() (feat Feature)

func (*CFeature) MakeTable

func (f *CFeature) MakeTable(ld *LocaleData) (table []Row, err error)

func (*CFeature) OpCancelHandler

func (f *CFeature) OpCancelHandler(r *http.Request, pg feature.Page, ctx context.Context, form context.Context, info *editor.File, eid string) (redirect string)

func (*CFeature) OpCancelValidate

func (f *CFeature) OpCancelValidate(r *http.Request, pg feature.Page, ctx, form context.Context, info *editor.File, eid string) (err error)

func (*CFeature) OpChangeHandler

func (f *CFeature) OpChangeHandler(r *http.Request, pg feature.Page, ctx context.Context, form context.Context, info *editor.File, eid string) (redirect string)

func (*CFeature) OpChangeValidate

func (f *CFeature) OpChangeValidate(r *http.Request, pg feature.Page, ctx, form context.Context, info *editor.File, eid string) (err error)

func (*CFeature) OpCommitHandler

func (f *CFeature) OpCommitHandler(r *http.Request, pg feature.Page, ctx context.Context, form context.Context, info *editor.File, eid string) (redirect string)

func (*CFeature) OpCommitValidate

func (f *CFeature) OpCommitValidate(r *http.Request, pg feature.Page, ctx, form context.Context, info *editor.File, eid string) (err error)

func (*CFeature) OpDeleteHandler

func (f *CFeature) OpDeleteHandler(r *http.Request, pg feature.Page, ctx context.Context, form context.Context, info *editor.File, eid string) (redirect string)

func (*CFeature) OpDeleteValidate

func (f *CFeature) OpDeleteValidate(r *http.Request, pg feature.Page, ctx, form context.Context, info *editor.File, eid string) (err error)

func (*CFeature) OpPublishHandler

func (f *CFeature) OpPublishHandler(r *http.Request, pg feature.Page, ctx context.Context, form context.Context, info *editor.File, eid string) (redirect string)

func (*CFeature) OpPublishValidate

func (f *CFeature) OpPublishValidate(r *http.Request, pg feature.Page, ctx, form context.Context, info *editor.File, eid string) (err error)

func (*CFeature) OpRetakeHandler

func (f *CFeature) OpRetakeHandler(r *http.Request, pg feature.Page, ctx context.Context, form context.Context, info *editor.File, eid string) (redirect string)

func (*CFeature) OpRetakeValidate

func (f *CFeature) OpRetakeValidate(r *http.Request, pg feature.Page, ctx, form context.Context, info *editor.File, eid string) (err error)

func (*CFeature) OpSearchHandler

func (f *CFeature) OpSearchHandler(r *http.Request, pg feature.Page, ctx context.Context, form context.Context, info *editor.File, eid string) (redirect string)

func (*CFeature) OpSearchValidate

func (f *CFeature) OpSearchValidate(r *http.Request, pg feature.Page, ctx, form context.Context, info *editor.File, eid string) (err error)

func (*CFeature) OpUnlockHandler

func (f *CFeature) OpUnlockHandler(r *http.Request, pg feature.Page, ctx context.Context, form context.Context, info *editor.File, eid string) (redirect string)

func (*CFeature) OpUnlockValidate

func (f *CFeature) OpUnlockValidate(r *http.Request, pg feature.Page, ctx, form context.Context, info *editor.File, eid string) (err error)

func (*CFeature) PrepareRenderFileEditor

func (f *CFeature) PrepareRenderFileEditor(w http.ResponseWriter, r *http.Request) (pg feature.Page, ctx context.Context, info *editor.File, eid string, mountPoints feature.MountPoints, handled bool)

func (*CFeature) ReadDraftLocales

func (f *CFeature) ReadDraftLocales(fsid, code string, mountPoints feature.MountPoints, withOut bool) (ld *LocaleData, err error)

func (*CFeature) ReceiveFileEditorChanges

func (f *CFeature) ReceiveFileEditorChanges(w http.ResponseWriter, r *http.Request)

func (*CFeature) RenderFileBrowser

func (f *CFeature) RenderFileBrowser(w http.ResponseWriter, r *http.Request)

func (*CFeature) RenderFileEditor

func (f *CFeature) RenderFileEditor(w http.ResponseWriter, r *http.Request)

func (*CFeature) SetupEditor

func (f *CFeature) SetupEditor(es feature.EditorSite)

func (*CFeature) SetupEditorRoute

func (f *CFeature) SetupEditorRoute(r chi.Router)

func (*CFeature) SiteFeatureMenu

func (f *CFeature) SiteFeatureMenu(r *http.Request) (m menu.Menu)

func (*CFeature) Startup

func (f *CFeature) Startup(ctx *cli.Context) (err error)

func (*CFeature) UnlockLocales

func (f *CFeature) UnlockLocales(fsid, code string) (err error)

func (*CFeature) UpdateFileInfo

func (f *CFeature) UpdateFileInfo(info *editor.File, r *http.Request)

func (*CFeature) UpdatePathInfo

func (f *CFeature) UpdatePathInfo(info *editor.File, r *http.Request)

func (*CFeature) WriteDraftLocales

func (f *CFeature) WriteDraftLocales(ld *LocaleData, mountPoints feature.MountPoints) (err error)

func (*CFeature) WriteLocales

func (f *CFeature) WriteLocales(ld *LocaleData, mountPoints feature.MountPoints) (err error)

type Cell

type Cell struct {
	Locale language.Tag
	Src    *LocaleMessage
	Msg    *LocaleMessage
}

type Feature

type Feature interface {
	feature.EditorFeature
}

type LocaleData

type LocaleData struct {
	FSID  string                                     `json:"fsid"`
	Code  string                                     `json:"code"`
	Data  map[string]map[language.Tag]*LocaleMessage `json:"data"`
	Order []string                                   `json:"order"`
}

func (*LocaleData) AddMissingTranslations

func (l *LocaleData) AddMissingTranslations(defTag language.Tag, locales []language.Tag)

func (*LocaleData) ConvertAllPlaceholders added in v0.5.1

func (l *LocaleData) ConvertAllPlaceholders()

func (*LocaleData) MakeGoTextData

func (l *LocaleData) MakeGoTextData() (lookup map[language.Tag]*lang.GoText)

func (*LocaleData) SetPluralTranslation

func (l *LocaleData) SetPluralTranslation(tag language.Tag, shasum, arg string, cases ...string) (err error)

func (*LocaleData) SetStringTranslation

func (l *LocaleData) SetStringTranslation(tag language.Tag, shasum, translation string) (err error)

type LocaleMessage

type LocaleMessage struct {
	ID                string             `json:"id"`
	Key               string             `json:"key"`
	Message           string             `json:"message"`
	Translation       *LocaleTranslation `json:"translation"`
	TranslatorComment string             `json:"translatorComment,omitempty"`
	Placeholders      lang.Placeholders  `json:"placeholders,omitempty"`
	Fuzzy             bool               `json:"fuzzy,omitempty"`
	Shasum            string             `json:"shasum"`
}

func ParseNewMessage

func ParseNewMessage(key, comment string) (m *LocaleMessage)

func (*LocaleMessage) Copy

func (l *LocaleMessage) Copy() (cloned *LocaleMessage)

type LocaleTranslation

type LocaleTranslation struct {
	String string  `json:"string"`
	Select *Select `json:"select"`
}

type MakeFeature

type MakeFeature interface {
	feature.EditorMakeFeature[MakeFeature]

	Make() Feature
}

func New

func New() MakeFeature

func NewTagged

func NewTagged(tag feature.Tag) MakeFeature

type Row

type Row []*Cell

type Select

type Select struct {
	Arg     string            `json:"arg"`
	Feature string            `json:"feature"`
	Cases   map[string]string `json:"cases"`
}

type Table

type Table struct {
	Rows []Row
}

Jump to

Keyboard shortcuts

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