瀏覽代碼

feat: add a make add string command to add new localized strings

Paul Stenius 1 年之前
父節點
當前提交
12ca7aa085
共有 1 個文件被更改,包括 10 次插入0 次删除
  1. 10 0
      Makefile

+ 10 - 0
Makefile

@@ -116,6 +116,16 @@ run:
 clean:
 clean:
 	@ rm -f $(APP)-* $(APP) $(APP)*.rpm $(APP)*.deb $(APP)*.exe $(APP)*.sha256
 	@ rm -f $(APP)-* $(APP) $(APP)*.rpm $(APP)*.deb $(APP)*.exe $(APP)*.sha256
 
 
+.PHONY: add-string
+add-string:
+	cd internal/locale/translations && \
+	for file in *.json; do \
+		jq --indent 4 --arg key "$(KEY)" --arg val "$(VAL)" \
+		   '. + {($$key): $$val} | to_entries | sort_by(.key) | from_entries' "$$file" > tmp && \
+		mv tmp "$$file"; \
+	done
+
+
 test:
 test:
 	go test -cover -race -count=1 ./...
 	go test -cover -race -count=1 ./...