Skip to content

Commit 7c370d3

Browse files
Updated travis.yml to no longer do unneeded i18n checks. Removed unneeded binary files
1 parent 9907cb3 commit 7c370d3

13 files changed

Lines changed: 54 additions & 509 deletions

.secrets.baseline

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"files": "plugin/i18n/v1Resources/|plugin/i18n/v2Resources/|(.*test.*)|(vendor)|(go.sum)|bin/|^.secrets.baseline$",
44
"lines": null
55
},
6-
"generated_at": "2024-05-23T15:22:23Z",
6+
"generated_at": "2024-05-23T21:29:26Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"

.travis.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ install:
1616
- sudo pip3 install --upgrade "git+https://github.com/ibm/detect-secrets.git@master#egg=detect-secrets"
1717
- curl -sfL https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh -s -- -b $GOPATH/bin
1818
before_script:
19-
- bash bin/catch-i18n-mismatch.sh
20-
- bash bin/generate-i18n-resources.sh
2119
- go vet $(go list ./... | grep -v "fixtures" | grep -v "vendor")
2220
- go test $(go list ./... | grep -v "fixtures" | grep -v "vendor")
2321
- detect-secrets scan --update .secrets.baseline

README.md

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,45 @@ cobraCmd.AddCommand(NewActionNameCommand(sl).Command)
339339

340340
anything with `T("some string here")` uses the internationalization system. Specifically we use the [goi18n/v2](https://github.com/nicksnyder/go-i18n) library for most work here.
341341

342-
Currently we use a custom version of [goi18n](https://github.com/allmightyspiff/go-i18n/tree/Tfunctions) which can parse `T()` functions like we use (an artiface of migrating from v1 to v2).
342+
Currently we use a custom version of [goi18n](https://github.com/allmightyspiff/go-i18n/tree/Tfunctions) which can parse `T()` functions like we use (an artiface of migrating from v1 to v2). The custom binary (`bin/goi18n2*`) has some code that forces the .json file it generates to be like the following, because otherwise the translations don't get loaded properly.
343343

344+
```json
345+
{
346+
"words you want translated" : {
347+
"other": "words you want translated"
348+
}
349+
}
350+
```
351+
352+
The changes are this for future reference:
353+
354+
```
355+
~/go/src/github.com/allmightyspiff/go-i18n (Tfunctions)
356+
$> git diff goi18n/marshal.go
357+
diff --git a/goi18n/marshal.go b/goi18n/marshal.go
358+
index a6cc762..a256f2b 100644
359+
--- a/goi18n/marshal.go
360+
+++ b/goi18n/marshal.go
361+
@@ -28,7 +28,9 @@ func marshalValue(messageTemplates map[string]*i18n.MessageTemplate, sourceLangu
362+
for id, template := range messageTemplates {
363+
if other := template.PluralTemplates[plural.Other]; sourceLanguage && len(template.PluralTemplates) == 1 &&
364+
other != nil && template.Description == "" && template.LeftDelim == "" && template.RightDelim == "" {
365+
- v[id] = other.Src
366+
+ m := map[string]string{}
367+
+ m["other"] = other.Src
368+
+ v[id] = m
369+
} else {
370+
m := map[string]string{}
371+
if template.Description != "" {
372+
```
373+
374+
To generate the en-US.json file, just run
375+
376+
```bash
377+
python bin/buildAndDeploy.py i18n
378+
```
379+
380+
The `plugin/i18n/v2Resources/active.*.json` files are all compiled into the binary automatically.
344381

345382
### Basic Patterns and Tips
346383

@@ -490,4 +527,18 @@ drwxr-xr-x 4 chris staff 128B Nov 30 13:01 output
490527

491528

492529
## TODO
493-
Automate build with https://github.ibm.com/coligo/cli/tree/main/script
530+
Automate build with https://github.ibm.com/coligo/cli/tree/main/script
531+
532+
533+
## Detect Secrets
534+
Make sure to add the pre-commit hook by running `pre-commit install`
535+
536+
To run a scan do:
537+
```bash
538+
detect-secrets scan --update .secrets.baseline
539+
```
540+
541+
If we need to update the excluded files (these are saved in the .secrets.baseline file) do this:
542+
```bash
543+
detect-secrets -v scan --update .secrets.baseline --exclude-files "plugin/i18n/v1Resources/|plugin/i18n/v2Resources/|(.*test.*)|(vendor)|(go.sum)|bin/"
544+
```

bin/build-all

Lines changed: 0 additions & 50 deletions
This file was deleted.

bin/catch-i18n-mismatch.sh

Lines changed: 0 additions & 142 deletions
This file was deleted.

bin/fixeverything_i18n.sh

Lines changed: 0 additions & 54 deletions
This file was deleted.

bin/format-translation-files.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

bin/generate-i18n-resources.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

bin/i18n_build.sh

Lines changed: 0 additions & 19 deletions
This file was deleted.

bin/replace-buildID

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)