ResultadosDigitais / matrix

#matrix is the online open-source workplace inspired in sococo.com for distributed teams to have the experience of work together each day, side-by-side. No matter where team members might be. Working in an online workplace is even more productive when people are feeling in the same space.
MIT License
901 stars 238 forks source link

Add i18next and language switcher #345

Closed phiter closed 4 years ago

phiter commented 4 years ago

Description

This PR adds i18next and react-i18next libraries to the project to initialize the i18n feature.

It also adds a language switch component to both the office and room appbars.

Initially only basic english and portuguese translations have been created.

The language will be set automatically according to the browser setting and if the user changes the language, the choice will be stored in the localStorage.

resolves #341

How to test?

  1. Login to the Matrix
  2. Look for the language switch button in the appbar and open it
  3. Click one of the languages.

Expected behavior

The language names will change to their versions in the selected language, as well as the tooltip of the language switcher menu activator.

phiter commented 4 years ago

Gonna fix those codeclimate issues later today.

phiter commented 4 years ago

These codeclimate issues are odd. It says invalid token <> for react fragments. I think that's the only reason the function is exceeding the limit (might be wrong though), because there are other components which have way more LOC.

Example:

https://github.com/ResultadosDigitais/matrix/blob/fe762bf22011001ecb4c8651c15fa5dbf5b4e1e8/frontend/src/components/RoomCard.js#L60-L118