Merge branch 'fix/0.5.0/i18n-init' into 'test'

fix: if i18n file exist, try to replace it when init. #95

See merge request opensource/answer!276
This commit is contained in:
linkinstar 2022-11-24 04:06:28 +00:00
commit fe5101b502
1 changed files with 7 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package cli
import (
"fmt"
"os"
"path/filepath"
"github.com/answerdev/answer/configs"
@ -96,6 +97,12 @@ func installI18nBundle() {
if err != nil {
continue
}
if dir.CheckFileExist(path) {
fmt.Printf("[i18n] install %s file exist, try to replace it\n", item.Name())
if err = os.Remove(path); err != nil {
fmt.Println(err)
}
}
fmt.Printf("[i18n] install %s bundle...\n", item.Name())
err = writer.WriteFile(path, string(content))
if err != nil {