Shift3 / boilerplate-client-react

The Bitwise standard starting point for new React web projects.
7 stars 10 forks source link

Adds the current language to the Accept-Language header #658

Closed joshwingreene closed 2 years ago

joshwingreene commented 2 years ago

Changes

  1. Adds the currently selected language to the Accept-Language header

Purpose

Adds the current language to the Accept-Language header so that the backend can identify the language for translation purposes (ex. return error messages in the user's language)

Learning

(MDN) Accept-Language

Testing Steps

  1. Pull in the changes to your local copy of this branch and run it alongside the jgg-translated-backend-error-msgs branch of the dj_starter_demo repo. (make sure you set up the branch correctly by following the testing steps in the associated PR)
  2. Create another user and change the language to Spanish
  3. Try to change the new user's email to the email of the original admin user. You should get a translated error message under the text input box (refer to the screenshot below).

Screenshots

change-email-validation-error

joshwingreene commented 2 years ago

A spanish (i18n) user should be able to see error messages from the server in their language