1602 / 1602/jugglingdb

It is impossible to use message translation in a model callbacks

Offen
#222 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
JavaScript
Sterne
2k
Forks
238
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Code example:

```
User.beforeUpdate = (next) ->
@errors.add 'password', t('passport.failure.invalid_password_format')
next()
```

I get:

```
this.errors.add('password', t('passport.failure.invalid_password_forma
^
ReferenceError: t is not defined
```

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Look at the model callback code in jugglingdb, likely in lib/model.js or similar, to see how callbacks are executed and what scope they have. Check if the translation function 't' is available in that scope or needs to be imported. Examine how other parts of the codebase handle translations, possibly in a localization module. The fix involves making the translation function accessible within callback contexts.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript, nodejs
Bereich
backend, databases
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.