You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/plugin_developer_guide.md
+78-21Lines changed: 78 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -372,7 +372,7 @@ To keep user experience consistent, developers of IBM Cloud CLI plug-in should a
372
372
373
373
4. Use"plug-in" instead of "plugin" in all places.
374
374
375
-
### 2.2. Name and Decription of Plug-in, Namespace and Command
375
+
### 2.2. Name and Description of Plug-in, Namespace and Command
376
376
377
377
**To name the plug-in for a service**:
378
378
@@ -384,8 +384,8 @@ To keep user experience consistent, developers of IBM Cloud CLI plug-in should a
384
384
- Use lower case words and hyphen
385
385
- Names should be at least 2 characters in length
386
386
- Follow a “noun-verb” sequence
387
-
- For commands that list objects, use the plural of the object name, e.g. `ibmcloud iam api-keys`. If a plural will not work, or it is already described in namespace, use `list`, such as `ibmcloud app list`.
388
-
- For commands that retrieve the details of an object, use the object name, e.g. `ibmcloud iam api-key`. If it does not work, use `show`, e.g. `ibmcloud app show`
387
+
- For commands that list objects, use the plural of the object name, e.g. `ibmcloud iam api-keys`. If a plural will not work, or it is already described in namespace, use `list`, such as `ibmcloud account list`.
388
+
- For commands that retrieve the details of an object, use the object name, e.g. `ibmcloud iam api-key`. If it does not work, use `show`, e.g. `ibmcloud account show`
389
389
- Use common verbs such as add, create, bind, update, delete …
390
390
- Use`remove` to remove an object from a collection or another object it associated with. Use`delete` to erase an object.
391
391
@@ -413,7 +413,7 @@ The following command names are invalid:
413
413
414
414
- `route map`: Uses a space instead of a hyphen.
415
415
416
-
- `route\_map`: Usesunallowedcharacters (`\_`) instead of a hyphen.
416
+
- `route\_map`: Usesprohibitedcharacters (`\_`) instead of a hyphen.
417
417
418
418
- `add-plugin-repo`: Does not follow "noun-verb" word order. The verb "add" should be the last part of the command name.
419
419
@@ -576,7 +576,6 @@ When command was successful, the success message should start with "OK" in green
576
576
Creating resource group Test under account TestAccount as user@ibm.com...
577
577
OK
578
578
Resource group Test was created.
579
-
Creating application 'my-app'...
580
579
```
581
580
582
581
The following code snippet can help you print the above message:
`T()` must be initialized before use. During i18n initialization in IBM Cloud CLI, user locale is used if it's set in `~/.bluemix/config.json` (plug-in can get user locale via `PluginContext.Locale()`). Otherwise, system locale is auto discovered (see [jibber\_jabber](https://github.com/cloudfoundry/jibber_jabber)) and used. If system locale is not detected or supported, default locale `en\_US` is then used. Next, we initialize the translate function with the locale. Sample code:
1204
+
`T()` must be initialized before use. During i18n initialization in IBM Cloud CLI, user locale is used if it's set in `~/.bluemix/config.json` (plug-in can get user locale via `PluginContext.Locale()`). Otherwise, system locale is auto discovered (see [go-locale](https://github.com/Xuanwo/go-locale)) and used. If system locale is not detected or supported, default locale `en\_US` is then used. Next, we initialize the translate function with the locale. Sample code:
1205
+
1206
+
**detection.go**
1207
+
```go
1208
+
1209
+
package detection
1210
+
1211
+
import (
1212
+
"github.com/Xuanwo/go-locale"
1213
+
)
1214
+
1215
+
//go:generate counterfeiter . Detector
1216
+
type Detector interface {
1217
+
DetectLocale() string
1218
+
DetectLanguage() string
1219
+
}
1220
+
1221
+
type GoLocaleDetector struct{}
1222
+
1223
+
// DetectLocale will return the current locale as a string.
1224
+
// The format of the locale will be the ISO 639 two-letter language code, a DASH, then an ISO 3166 two-letter country code.
0 commit comments