feat: kubesphere 4.0 (#6115)

* feat: kubesphere 4.0

Signed-off-by: ci-bot <ci-bot@kubesphere.io>

* feat: kubesphere 4.0

Signed-off-by: ci-bot <ci-bot@kubesphere.io>

---------

Signed-off-by: ci-bot <ci-bot@kubesphere.io>
Co-authored-by: ks-ci-bot <ks-ci-bot@example.com>
Co-authored-by: joyceliu <joyceliu@yunify.com>
This commit is contained in:
KubeSphere CI Bot
2024-09-06 11:05:52 +08:00
committed by GitHub
parent b5015ec7b9
commit 447a51f08b
8557 changed files with 546695 additions and 1146174 deletions

View File

@@ -24,8 +24,10 @@ import (
"fmt"
"os"
"strings"
"sync"
"github.com/chai2010/gettext-go"
gettext "github.com/chai2010/gettext-go"
"k8s.io/klog/v2"
)
@@ -52,6 +54,56 @@ var knownTranslations = map[string][]string{
},
}
var (
lazyLoadTranslationsOnce sync.Once
LoadTranslationsFunc = func() error {
return LoadTranslations("kubectl", nil)
}
translationsLoaded bool
)
// SetLoadTranslationsFunc sets the function called to lazy load translations.
// It must be called in an init() func that occurs BEFORE any i18n.T() calls are made by any package. You can
// accomplish this by creating a separate package containing your init() func, and then importing that package BEFORE
// any other packages that call i18n.T().
//
// Example Usage:
//
// package myi18n
//
// import "k8s.io/kubectl/pkg/util/i18n"
//
// func init() {
// if err := i18n.SetLoadTranslationsFunc(loadCustomTranslations); err != nil {
// panic(err)
// }
// }
//
// func loadCustomTranslations() error {
// // Load your custom translations here...
// }
//
// And then in your main or root command package, import your custom package like this:
//
// import (
// // Other imports that don't need i18n...
// _ "example.com/myapp/myi18n"
// // Other imports that do need i18n...
// )
func SetLoadTranslationsFunc(f func() error) error {
if translationsLoaded {
return errors.New("translations have already been loaded")
}
LoadTranslationsFunc = func() error {
if err := f(); err != nil {
return err
}
translationsLoaded = true
return nil
}
return nil
}
func loadSystemLanguage() string {
// Implements the following locale priority order: LC_ALL, LC_MESSAGES, LANG
// Similarly to: https://www.gnu.org/software/gettext/manual/html_node/Locale-Environment-Variables.html
@@ -128,13 +180,26 @@ func LoadTranslations(root string, getLanguageFn func() string) error {
gettext.BindLocale(gettext.New("k8s", root+".zip", buf.Bytes()))
gettext.SetDomain("k8s")
gettext.SetLanguage(langStr)
translationsLoaded = true
return nil
}
func lazyLoadTranslations() {
lazyLoadTranslationsOnce.Do(func() {
if translationsLoaded {
return
}
if err := LoadTranslationsFunc(); err != nil {
klog.Warning("Failed to load translations")
}
})
}
// T translates a string, possibly substituting arguments into it along
// the way. If len(args) is > 0, args1 is assumed to be the plural value
// and plural translation is used.
func T(defaultValue string, args ...int) string {
lazyLoadTranslations()
if len(args) == 0 {
return gettext.PGettext("", defaultValue)
}

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# Copyright 2017 The Kubernetes Authors.
#

View File

@@ -712,14 +712,10 @@ msgid ""
"\n"
"\t\t# Create an interactive debugging session in pod mypod and immediately "
"attach to it.\n"
"\t\t# (requires the EphemeralContainers feature to be enabled in the "
"cluster)\n"
"\t\tkubectl debug mypod -it --image=busybox\n"
"\n"
"\t\t# Create a debug container named debugger using a custom automated "
"debugging image.\n"
"\t\t# (requires the EphemeralContainers feature to be enabled in the "
"cluster)\n"
"\t\tkubectl debug --image=myproj/debug-tools -c debugger mypod\n"
"\n"
"\t\t# Create a copy of mypod adding a debug container and attach to it\n"
@@ -746,14 +742,10 @@ msgstr ""
"\n"
"\t\t# Create an interactive debugging session in pod mypod and immediately "
"attach to it.\n"
"\t\t# (requires the EphemeralContainers feature to be enabled in the "
"cluster)\n"
"\t\tkubectl debug mypod -it --image=busybox\n"
"\n"
"\t\t# Create a debug container named debugger using a custom automated "
"debugging image.\n"
"\t\t# (requires the EphemeralContainers feature to be enabled in the "
"cluster)\n"
"\t\tkubectl debug --image=myproj/debug-tools -c debugger mypod\n"
"\n"
"\t\t# Create a copy of mypod adding a debug container and attach to it\n"

View File

@@ -712,14 +712,10 @@ msgid ""
"\n"
"\t\t# Create an interactive debugging session in pod mypod and immediately "
"attach to it.\n"
"\t\t# (requires the EphemeralContainers feature to be enabled in the "
"cluster)\n"
"\t\tkubectl debug mypod -it --image=busybox\n"
"\n"
"\t\t# Create a debug container named debugger using a custom automated "
"debugging image.\n"
"\t\t# (requires the EphemeralContainers feature to be enabled in the "
"cluster)\n"
"\t\tkubectl debug --image=myproj/debug-tools -c debugger mypod\n"
"\n"
"\t\t# Create a copy of mypod adding a debug container and attach to it\n"
@@ -746,14 +742,10 @@ msgstr ""
"\n"
"\t\t# Create an interactive debugging session in pod mypod and immediately "
"attach to it.\n"
"\t\t# (requires the EphemeralContainers feature to be enabled in the "
"cluster)\n"
"\t\tkubectl debug mypod -it --image=busybox\n"
"\n"
"\t\t# Create a debug container named debugger using a custom automated "
"debugging image.\n"
"\t\t# (requires the EphemeralContainers feature to be enabled in the "
"cluster)\n"
"\t\tkubectl debug --image=myproj/debug-tools -c debugger mypod\n"
"\n"
"\t\t# Create a copy of mypod adding a debug container and attach to it\n"

View File

@@ -2167,7 +2167,7 @@ msgstr "Kubectl controlla il gestore cluster di Kubernetes"
#~ msgstr ""
#~ "\n"
#~ "\t\tCrea un autoscaler che automaticamente sceglie e imposta il numero di "
#~ "pod che vengono eseguiti in un cluster di kubernets.\n"
#~ "pod che vengono eseguiti in un cluster di kubernetes.\n"
#~ "\n"
#~ "\t\tEsegue una ricerca di un Deployment, ReplicaSet o "
#~ "ReplicationController per nome e crea un autoscaler che utilizza la "

File diff suppressed because it is too large Load Diff

View File

@@ -31,7 +31,7 @@ msgid ""
msgstr ""
"\n"
"\t\t # 显示所有节点的指标\n"
"\t\t kubectl top ode\n"
"\t\t kubectl top node\n"
"\n"
"\t\t # 显示指定节点的指标\n"
"\t\t kubectl top node NODE_NAME"