🎨 complete language configs and fix Arabic translations (#13605)

This commit is contained in:
W.Kai 2024-12-27 17:00:06 +08:00 committed by GitHub
parent 59a90bb0fa
commit 2d8152381c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 78 additions and 63 deletions

View file

@ -42,6 +42,7 @@ import (
type DisplayName struct {
Default string `json:"default"`
ArSA string `json:"ar_SA"`
DeDE string `json:"de_DE"`
EnUS string `json:"en_US"`
EsES string `json:"es_ES"`
@ -57,6 +58,7 @@ type DisplayName struct {
type Description struct {
Default string `json:"default"`
ArSA string `json:"ar_SA"`
DeDE string `json:"de_DE"`
EnUS string `json:"en_US"`
EsES string `json:"es_ES"`
@ -72,6 +74,7 @@ type Description struct {
type Readme struct {
Default string `json:"default"`
ArSA string `json:"ar_SA"`
DeDE string `json:"de_DE"`
EnUS string `json:"en_US"`
EsES string `json:"es_ES"`
@ -166,6 +169,10 @@ func getPreferredReadme(readme *Readme) string {
ret := readme.Default
switch util.Lang {
case "ar_SA":
if "" != readme.ArSA {
ret = readme.ArSA
}
case "de_DE":
if "" != readme.DeDE {
ret = readme.DeDE
@ -228,6 +235,10 @@ func GetPreferredName(pkg *Package) string {
ret := pkg.DisplayName.Default
switch util.Lang {
case "ar_SA":
if "" != pkg.DisplayName.ArSA {
ret = pkg.DisplayName.ArSA
}
case "de_DE":
if "" != pkg.DisplayName.DeDE {
ret = pkg.DisplayName.DeDE
@ -290,6 +301,10 @@ func getPreferredDesc(desc *Description) string {
ret := desc.Default
switch util.Lang {
case "ar_SA":
if "" != desc.ArSA {
ret = desc.ArSA
}
case "de_DE":
if "" != desc.DeDE {
ret = desc.DeDE