Skip to content
This repository has been archived by the owner on Aug 29, 2018. It is now read-only.

i18n support #28

Closed
andycaramba opened this issue Jul 18, 2017 · 2 comments
Closed

i18n support #28

andycaramba opened this issue Jul 18, 2017 · 2 comments

Comments

@andycaramba
Copy link

How can I internationalise error messages like 'Invalid login' and so on?

@daffl
Copy link
Member

daffl commented Jul 18, 2017

You can modify the error with hook.error in an error hook:

app.service('myservice').hooks({
  error(hook) {
    const { error } = hook;

    if(error.name === 'NotAuthenticated' && hook.params.user.language === 'de') {
      error.message = "Bitte anmelden";
    }

    hook.error = error;
  }
})

@andycaramba
Copy link
Author

@daffl thank you, it works

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants