mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-19 17:02:18 +03:00
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.
27 lines
476 B
Go
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)
|
|
}
|
|
}
|