Skip to content

Commit 7ff73f1

Browse files
removed debugging code
1 parent 89ff530 commit 7ff73f1

1 file changed

Lines changed: 1 addition & 30 deletions

File tree

plugin/i18n/i18n.go

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package i18n
22

33
import (
4-
"path/filepath"
54
"embed"
65
"strings"
76
"golang.org/x/text/language"
@@ -10,7 +9,6 @@ import (
109
"github.com/IBM-Cloud/ibm-cloud-cli-sdk/bluemix/configuration/core_config"
1110
"github.com/Xuanwo/go-locale"
1211
goi18n "github.com/nicksnyder/go-i18n/v2/i18n"
13-
// "github.ibm.com/SoftLayer/softlayer-cli/plugin/resources"
1412
)
1513

1614
//go:embed v2Resources/active.*.json
@@ -33,37 +31,14 @@ var SUPPORTED_LOCALES = []string{
3331
"zh_Hant",
3432
}
3533

36-
var resourcePath = filepath.Join("plugin", "i18n", "v2Resources")
3734
var localizer = Init()
3835

3936

40-
// var matcher = InitMatcher()
41-
42-
43-
// func InitMatcher() language.Matcher {
44-
// var supported []language.Tag
45-
// for _, lang := range SUPPORTED_LOCALES {
46-
// supported = append(supported, language.MustParse(lang))
47-
// }
48-
// return language.NewMatcher(supported)
49-
// }
50-
51-
func GetResourcePath() string {
52-
return resourcePath
53-
}
54-
55-
func SetResourcePath(path string) {
56-
resourcePath = path
57-
}
58-
59-
// var T goi18n.TranslateFunc = Init(core_config.NewCoreConfig(func(error) {}))
60-
6137
// Translates a string, with any substitutions needed
6238
// text: string to be translated
6339
// subs: A single map[string]interface{}
6440
func T(text string, subs ...interface{}) string {
6541

66-
// fmt.Printf("SUBS: %v\n", subs)
6742
config := &goi18n.LocalizeConfig{
6843
DefaultMessage: &goi18n.Message{ID: text, Other: text, One: text},
6944
}
@@ -75,14 +50,12 @@ func T(text string, subs ...interface{}) string {
7550

7651
l_string, err := localizer.Localize(config)
7752
if err != nil {
78-
fmt.Printf("ERROR i18n: %v\n", err.Error())
53+
// fmt.Printf("ERROR i18n: %v\n", err.Error())
7954
// return err.Error()
8055
}
8156
return l_string
8257
}
8358

84-
85-
8659
// Sets the localizer, reads local from config/system
8760
func Init() *goi18n.Localizer {
8861

@@ -117,7 +90,6 @@ func SetLocalizer(new_localizer *goi18n.Localizer) {
11790
localizer = new_localizer
11891
}
11992

120-
12193
// Tries to determine the system locale, when local isn't set, default to en_US
12294
func DetectLocal() string {
12395
tag, err := locale.Detect()
@@ -129,7 +101,6 @@ func DetectLocal() string {
129101
return locale
130102
}
131103

132-
133104
// Tries to match the system locale with a supported locale, otherwise sets a DEFAULT_LOCALE
134105
func supportedLocale(configLocal string) string {
135106

0 commit comments

Comments
 (0)