MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / Messages

Method Messages

tools/mage/js.go:196–218  ·  view source on GitHub ↗

Messages extracts the frontend messages via babel.

()

Source from the content-addressed store, hash-verified

194
195// Messages extracts the frontend messages via babel.
196func (js Js) Messages() error {
197 mg.Deps(js.Deps)
198 ok, err := target.Dir(
199 filepath.Join(".cache", "messages"),
200 filepath.Join("pkg", "webui"),
201 )
202 if err != nil {
203 return targetError(err)
204 }
205 if !ok {
206 return nil
207 }
208 if mg.Verbose() {
209 fmt.Println("Extracting frontend messages")
210 }
211 if err = sh.Rm(filepath.Join(".cache", "messages")); err != nil {
212 return fmt.Errorf("failed to delete existing messages: %w", err)
213 }
214 if err = os.MkdirAll(filepath.Join("pkg", "webui", "locales"), 0o755); err != nil {
215 return fmt.Errorf("failed to create locale directory: %w", err)
216 }
217 return execYarn(nil, os.Stderr, "babel", "--ignore", "\"**/story.js\"", "--ignore", "\"**/*_test.js\"", filepath.Join("pkg", "webui"))
218}
219
220// Translations writes the babel message files and converts them into locale files.
221func (js Js) Translations() {

Callers

nothing calls this directly

Calls 6

targetErrorFunction · 0.85
execYarnFunction · 0.85
DirMethod · 0.80
JoinMethod · 0.65
ErrorfMethod · 0.65
DepsMethod · 0.45

Tested by

no test coverage detected