github.com/gocaveman/caveman@v0.0.0-20191211162744-0ddf99dbdf6e/i18n/i18neditor/i18neditor.go (about)

     1  // Provides a Go interface, REST endpoints and a web UI for editing translations.
     2  package i18neditor
     3  
     4  //
     5  // figure out what methods are needed for this concept of a set of files that correlates to translations
     6  // and read/write for it
     7  //
     8  // maybe even something you can embed that handles the file stuff and you only have to implement the
     9  // read/write for your specific format - could be very useful
    10  //
    11  // should also be able to serve as a Translator
    12  //
    13  // webserver/handler
    14  //
    15  // think about the workflow a bit: "what's left to translate" and similar situations
    16  //
    17  // hm - integration with google translate api would be really awesome here... at least make sure this is feasible to add
    18  //
    19  
    20  type Editor interface {
    21  	// FilesForLocale() ([]string, error)
    22  	Files() ([]FileInfo, error)
    23  	FileInfoFor(path string) (FileInfo, error)
    24  	FileContentsFor(path string) (*FileContents, error)
    25  	WriteFileRecords(path string, fileRecords []FileRecord) error
    26  }
    27  
    28  type FileInfo struct {
    29  	Path   string
    30  	Group  string
    31  	Locale string
    32  }
    33  
    34  type FileContents struct {
    35  	FileRecords []FileRecord
    36  }
    37  
    38  type FileRecord struct {
    39  	ID      string // surrogate key in case it's neded, can describe location in XLIFF file, etc.
    40  	Key     string
    41  	Value   string
    42  	Data    string // ? (additional data as JSON?)
    43  	Comment string
    44  }
    45  
    46  // TODO: add REST server that exposes an Editor