Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v2] Add support for internationalization with TranslateErrors middleware #33

Merged
merged 6 commits into from
Jul 23, 2019

Conversation

rschef
Copy link
Contributor

@rschef rschef commented Jul 23, 2019

Add support for internationalization with TranslateErrors middleware:

  • Rename HandleChangesetErrors middleware to TranslateErrors
  • Implement internationalization using Gettext and default Crudry.Translator module
  • Allow overriding default translator Crudry.Translator by adding a custom translator in Absinthe's context
  • Allow overriding default language en by passing a custom locale in Absinthe's context
  • Translate Ecto error messages using domain defined in Translator.errors_domain/0, which defaults to errors
  • Translate Ecto schema fields using domain defined in Translator.schema_fields_domain/0, which defaults to schema_fields
  • Add tests
  • Improve modules docs

test/middlewares/translate_errors_test.exs Outdated Show resolved Hide resolved
mix.lock Outdated Show resolved Hide resolved
@gabrielpra1
Copy link
Member

It looks like you're missing a test for when the translator does not define the expected functions
https://coveralls.io/builds/24744730/source?filename=lib%2Fmiddlewares%2Ftranslate_errors.ex#L126

@gabrielpra1 gabrielpra1 merged commit 5df9529 into jungsoft:v2.0 Jul 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants