1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-04-19 17:02:18 +03:00
lazygit/cmd/i18n/main.go
Stefan Haller 741d9a26b6 Change script to write only the English translation set to JSON
We will have to do this regularly in order to upload it to Crowdin (or Weblate
or whatever translation system we are going to use).

Unlike the non-English JSON files, the en.json file is not committed to the git
repo.
2024-06-23 14:47:50 +02:00

27 lines
476 B
Go

package main
import (
"encoding/json"
"log"
"os"
"github.com/jesseduffield/lazygit/pkg/i18n"
)
func saveLanguageFileToJson(tr *i18n.TranslationSet, filepath string) error {
jsonData, err := json.MarshalIndent(tr, "", " ")
if err != nil {
return err
}
jsonData = append(jsonData, '\n')
return os.WriteFile(filepath, jsonData, 0o644)
}
func main() {
err := saveLanguageFileToJson(i18n.EnglishTranslationSet(), "en.json")
if err != nil {
log.Fatal(err)
}
}