Skip to content

Commit

Permalink
Merge branch 'release/1.3.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
LinkinStars committed Jul 25, 2024
2 parents 3ce6925 + d841396 commit d2401cc
Show file tree
Hide file tree
Showing 137 changed files with 3,373 additions and 506 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*.rej
*.so
*~
*.db
.DS_Store
._*
/.idea
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.PHONY: build clean ui

VERSION=1.3.5
VERSION=1.3.6
BIN=answer
DIR_SRC=./cmd/answer
DOCKER_CMD=docker
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ To learn more about the project, visit [answer.apache.org](https://answer.apache
### Running with docker

```bash
docker run -d -p 9080:80 -v answer-data:/data --name answer apache/answer:1.3.5
docker run -d -p 9080:80 -v answer-data:/data --name answer apache/answer:1.3.6
```

For more information, see [Installation](https://answer.apache.org/docs/installation).
Expand Down
32 changes: 31 additions & 1 deletion cmd/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ var (
upgradeVersion string
// The fields that need to be set to the default value
configFields []string
// i18nSourcePath i18n from path
i18nSourcePath string
// i18nTargetPath i18n to path
i18nTargetPath string
)

func init() {
Expand All @@ -68,7 +72,11 @@ func init() {

configCmd.Flags().StringSliceVarP(&configFields, "with", "w", []string{}, "the fields that need to be set to the default value, eg: -w allow_password_login")

for _, cmd := range []*cobra.Command{initCmd, checkCmd, runCmd, dumpCmd, upgradeCmd, buildCmd, pluginCmd, configCmd} {
i18nCmd.Flags().StringVarP(&i18nSourcePath, "source", "s", "", "i18n source path, eg: -f ./i18n/source")

i18nCmd.Flags().StringVarP(&i18nTargetPath, "target", "t", "", "i18n target path, eg: -t ./i18n/target")

for _, cmd := range []*cobra.Command{initCmd, checkCmd, runCmd, dumpCmd, upgradeCmd, buildCmd, pluginCmd, configCmd, i18nCmd} {
rootCmd.AddCommand(cmd)
}
}
Expand Down Expand Up @@ -271,6 +279,28 @@ To run answer, use:
}
},
}

// i18nCmd used to merge i18n files
i18nCmd = &cobra.Command{
Use: "i18n",
Short: "overwrite i18n files",
Long: `Merge i18n files from plugins to original i18n files. It will overwrite the original i18n files`,
Run: func(_ *cobra.Command, _ []string) {
if err := cli.ReplaceI18nFilesLocal(i18nTargetPath); err != nil {
fmt.Printf("replace i18n files failed %v", err)
} else {
fmt.Printf("replace i18n files successfully\n")
}

fmt.Printf("try to merge i18n files from %q to %q\n", i18nSourcePath, i18nTargetPath)

if err := cli.MergeI18nFilesLocal(i18nTargetPath, i18nSourcePath); err != nil {
fmt.Printf("merge i18n files failed %v", err)
} else {
fmt.Printf("merge i18n files successfully\n")
}
},
}
)

// Execute adds all child commands to the root command and sets flags appropriately.
Expand Down
4 changes: 2 additions & 2 deletions cmd/wire_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d2401cc

Please sign in to comment.