Skip to content

Commit

Permalink
feat(bot): from english to multi language
Browse files Browse the repository at this point in the history
  • Loading branch information
sanchezcarlosjr committed May 19, 2021
1 parent a8a4284 commit d08e7f4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion apps/bot/infraestructure/FileRepository.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func NewFileRepositoryFromStorage(url string, fileName string) domain.DatabaseRe

func LoadFileRepositoryFromStorage() domain.DatabaseRepository {
fileDownloader := shared.FileDownloader{}
Translation = NewTranslation("es-MX")
Translation = NewTranslation()
fileInMemory, _ := fileDownloader.Read(Translation.DatabaseURL)
file := FileRepository{
index: 0,
Expand Down
6 changes: 5 additions & 1 deletion apps/bot/infraestructure/Translation.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ type TranslationRepository struct {
DatabaseURL string `json:"databaseURL"`
}

func NewTranslation(language string) TranslationRepository {
func NewTranslation() TranslationRepository {
language := os.Getenv("questions_game_language")
if language == "" {
language = "en-US"
}
jsonFile, err := os.Open("translations/" + language + ".json")
if err != nil {
fmt.Println(err)
Expand Down

0 comments on commit d08e7f4

Please sign in to comment.