func NewListQuotas(ui terminal.UI, config configuration.Reader, quotaRepo api.QuotaRepository) (cmd *ListQuotas) { t, err := i18n.Init("quota", i18n.GetResourcesPath()) if err != nil { ui.Failed(err.Error()) } return &ListQuotas{ ui: ui, config: config, quotaRepo: quotaRepo, T: t, } }
func NewCreateQuota(ui terminal.UI, config configuration.Reader, quotaRepo api.QuotaRepository) CreateQuota { t, err := i18n.Init("quota", i18n.GetResourcesPath()) if err != nil { ui.Failed(err.Error()) } return CreateQuota{ ui: ui, config: config, quotaRepo: quotaRepo, T: t, } }
func init() { T = i18n.Init("cf/api/resources", i18n.GetResourcesPath()) }
func init() { T = i18n.Init("cf/commands/application", i18n.GetResourcesPath()) }
"github.com/cloudfoundry/cli/cf/errors" "github.com/cloudfoundry/cli/cf/terminal" "github.com/cloudfoundry/cli/cf/trace" "net" "net/http" "net/http/httputil" "net/url" "regexp" "strings" "time" "github.com/cloudfoundry/cli/cf/i18n" ) var ( t = i18n.Init("cf/net", i18n.GetResourcesPath()) PRIVATE_DATA_PLACEHOLDER = t("[PRIVATE DATA HIDDEN]") ) func newHttpClient(trustedCerts []tls.Certificate, disableSSL bool) *http.Client { tr := &http.Transport{ TLSClientConfig: NewTLSConfig(trustedCerts, disableSSL), Proxy: http.ProxyFromEnvironment, } return &http.Client{ Transport: tr, CheckRedirect: PrepareRedirect, } }
. "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("i18n.Init() function", func() { var ( oldResourcesPath string configRepo configuration.ReadWriter T go_i18n.TranslateFunc ) BeforeEach(func() { configRepo = testconfig.NewRepositoryWithDefaults() oldResourcesPath = i18n.GetResourcesPath() i18n.Resources_path = filepath.Join("cf", "i18n", "test_fixtures") }) JustBeforeEach(func() { T = i18n.Init(configRepo) }) Describe("When a user has a locale configuration set", func() { It("panics when the translation files cannot be loaded", func() { i18n.Resources_path = filepath.Join("should", "not", "be_valid") configRepo.SetLocale("en_us") init := func() { i18n.Init(configRepo) } Ω(init).Should(Panic(), "loading translations from an invalid path should panic") })
func init() { T = i18n.Init(filepath.Join("cf", "ui_helpers"), i18n.GetResourcesPath()) }
func init() { T = i18n.Init(filepath.Join("cf", "commands", "space"), i18n.GetResourcesPath()) }
"strings" "time" "github.com/cloudfoundry/cli/cf" "github.com/cloudfoundry/cli/cf/command_metadata" "github.com/cloudfoundry/cli/cf/command_runner" "github.com/cloudfoundry/cli/cf/errors" "github.com/cloudfoundry/cli/cf/terminal" "github.com/cloudfoundry/cli/cf/trace" "github.com/codegangsta/cli" "github.com/cloudfoundry/cli/cf/i18n" ) var ( t = i18n.Init("cf/app", i18n.GetResourcesPath()) appHelpTemplate = `{{.Title "` + t("NAME:") + `"}} {{.Name}} - {{.Usage}} {{.Title "` + t("USAGE:") + `"}} ` + t("[environment variables]") + ` {{.Name}} ` + t("[global options] command [arguments...] [command options]") + ` {{.Title "` + t("VERSION:") + `"}} {{.Version}} {{.Title "` + t("BUILD TIME:") + `"}} {{.Compiled}} {{range .Commands}} {{.SubTitle .Name}}{{range .CommandSubGroups}} {{range .}} {{.Name}} {{.Description}} {{end}}{{end}}{{end}}
func init() { T = i18n.Init("cf/configuration", i18n.GetResourcesPath()) }
func init() { T = i18n.Init("cf/manifest", i18n.GetResourcesPath()) }
func init() { T = i18n.Init("cf/commands/domain", i18n.GetResourcesPath()) }
func init() { T = i18n.Init("cf/commands/servicebroker", i18n.GetResourcesPath()) }
func init() { T = i18n.Init("cf/commands/organization", i18n.GetResourcesPath()) }
func init() { T = i18n.Init(filepath.Join("cf", "commands", "serviceauthtoken"), i18n.GetResourcesPath()) }
func init() { T = i18n.Init("cf/actors", i18n.GetResourcesPath()) }
func init() { T = i18n.Init("cf/formatters", i18n.GetResourcesPath()) }
func init() { T = i18n.Init("cf/commands/route", i18n.GetResourcesPath()) }
func init() { T = i18n.Init(filepath.Join("cf", "terminal"), i18n.GetResourcesPath()) }
func init() { T = i18n.Init("cf/trace", i18n.GetResourcesPath()) }
func init() { T = i18n.Init("cf/api/strategy", i18n.GetResourcesPath()) }
func init() { T = i18n.Init("cf/requirements", i18n.GetResourcesPath()) }
func init() { T = i18n.Init("cf/net", i18n.GetResourcesPath()) }
func init() { T = i18n.Init("cf/command_factory", i18n.GetResourcesPath()) }
func init() { T = i18n.Init("cf/api/authentication", i18n.GetResourcesPath()) }
func init() { T = i18n.Init("cf/command_runner", i18n.GetResourcesPath()) }
func init() { T = i18n.Init(filepath.Join("cf", "commands", "securitygroup"), i18n.GetResourcesPath()) }
if len(parts) < 3 { return 0, invalidByteQuantityError } value, err := strconv.ParseUint(parts[1], 10, 0) if err != nil || value < 1 { return 0, invalidByteQuantityError } var bytes uint64 unit := strings.ToUpper(parts[2]) switch unit { case "T": bytes = value * TERABYTE case "G": bytes = value * GIGABYTE case "M": bytes = value * MEGABYTE case "K": bytes = value * KILOBYTE } return bytes / MEGABYTE, nil } var ( bytesPattern *regexp.Regexp = regexp.MustCompile(`(?i)^(-?\d+)([KMGT])B?$`) t = i18n.Init("cf/formatters", i18n.GetResourcesPath()) invalidByteQuantityError = errors.New(t("Byte quantity must be a positive integer with a unit of measurement like M, MB, G, or GB")) )