func rebuildLang(lang string, domain string) { ignores := []string{ "bower_components", "img", "languages", "fonts", "bower.json", "scss", } var parsepath string if domain == "web" { parsepath = config.CurWebPath } else if domain == "server" { parsepath = config.DevDistPath + "/src/github.com/croll/arkeogis-server" } newTrans := make(map[string]string) parseDir(parsepath, ignores, newTrans) oldTrans, err := translate.ReadTranslation(lang, domain) if err != nil { log.Println("Problem while loading origin translation : ", err, " using empty one") oldTrans = make(map[string]string) } translate.MergeIn(newTrans, oldTrans) err = translate.WriteJSON(translate.PlateToTree(newTrans), lang, domain) if err != nil { fmt.Println(err) } }
// UserCreate Create a user, see usercreate struct inside this function for json content func TranslatesSave(w http.ResponseWriter, r *http.Request, proute routes.Proute) { params := proute.Params.(*TranslateSaveParams) newtrans := proute.Json.(*map[string]interface{}) trans, err := translate.ReadTranslation(params.Lang, params.Side) if err != nil { ArkeoError(w, 404, err.Error()) return } tree := translate.PlateToTree(trans) domain := r.FormValue("domain") tree[domain] = *newtrans err = translate.WriteJSON(tree, params.Lang, params.Side) if err != nil { fmt.Println("WriteJSON failed: ", err) return } translate.Reinit() log.Println("theoriquement saved") }