It is impossible to use message translation in a model callbacks
- Langage dominant
- JavaScript
- Étoiles
- 2k
- Forks
- 238
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
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
```
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- javascript, nodejs
- Domaine
- backend, databases
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Clairement spécifiée
- Accessibilité débutants
- 45/100