i18n4go
i18n4go copied to clipboard
Missing placeholder for importing the go-bindata resource method in the template
Context
The CLI assumes that the user will use go-bindata
to generate a binary file of the localization JSON files. When running the command rewrite-command
the CLI will generate a i18n_init.go
from a template provided by the CLI (assuming the --init-code-snippet-filename
is not provided).
The generated i18n_init.go
will call the method resources.Asset
to retrieve the binary file. The file does not contain the import for calling the Asset
method so a runtime error will be thrown when building the source code that was modified by the rewrite-command
Suggestions
- Include in the docs that the user must have generate the binary file using
go-bindata
and import the go file (i18n_resources.go
) into the generatedi18n_init.go
- Generate the binary data for the user and add the import to the generated
i18n_init.go
Caveats
For options 2, go-bindata
doesn't have a library that we can call to run the generation.