Latexize localization output.
parent
9a1ae642f9
commit
82b620cbfd
|
@ -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{
|
||||||
|
|
Loading…
Reference in New Issue