Latexize localization output.

master
Carl Kittelberger 2017-02-20 12:36:22 +01:00
parent 9a1ae642f9
commit 82b620cbfd
Signed by: icedream
GPG Key ID: C1D30A06E6490C14
1 changed files with 8 additions and 1 deletions

View File

@ -8,6 +8,7 @@ import (
"github.com/jinzhu/now" "github.com/jinzhu/now"
"github.com/nicksnyder/go-i18n/i18n" "github.com/nicksnyder/go-i18n/i18n"
"git.dekart811.net/icedream/workreportmgr/export/latex/stringutil"
"git.dekart811.net/icedream/workreportmgr/project" "git.dekart811.net/icedream/workreportmgr/project"
) )
@ -29,11 +30,17 @@ type Exporter struct {
// Export generates LaTeX code from the given project and writes it to the given // Export generates LaTeX code from the given project and writes it to the given
// writer. // writer.
func (e *Exporter) Export(prj *project.Project, w io.Writer) (err error) { func (e *Exporter) Export(prj *project.Project, w io.Writer) (err error) {
T, err := i18n.Tfunc(e.Locale) originalT, err := i18n.Tfunc(e.Locale)
if err != nil { if err != nil {
return return
} }
// Wrap translations with latexize just to be safe
// type TranslateFunc func(translationID string, args ...interface{}) string
T := func(translationID string, args ...interface{}) string {
return stringutil.Latexize(originalT(translationID, args...))
}
now.FirstDayMonday = prj.FirstDayMonday now.FirstDayMonday = prj.FirstDayMonday
exportTemplate = exportTemplate.Funcs(template.FuncMap{ exportTemplate = exportTemplate.Funcs(template.FuncMap{