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

Adds internationalization #342

Open phiter opened 4 years ago

phiter commented 4 years ago

Description

Well guys get ready for this one, it's a pretty big PR.

matrix (Ignore the color twitching, I had to compress the gif a lot.)


This PR adds internationalization feature for the Matrix.

I extracted all component strings and put them in language files under the new src/locales folder, I also translated all of them to portuguese.

This is the proposed file structure, which is the commonly used across applications with i18n.

image

There are some other strings that I couldn't translate, which are not within components, so that is something we'll have to work on until this PR can be merged.

I had to do some refactoring in some parts of the code so I could use i18n, and I also had to replace the Google SignIn button so I could translate the text. I also changed some other things that I deemed necessary (some a11y stuff, for example).

Some tests are currently failing and I will work on that as soon as I can find a way to mock i18next or just use it in the tests.

I also didn't add anything to the backend, so if there are any messages there that need translation, that's also something that needs to be worked on.

How to test?

Once you open the matrix, the application will now try to check what's the preferred language using navigator.language and fallback to the default locale (en) if the language is not supported by matrix.

When logged in, there's a new button in the appbar that opens the language switcher menu, which currently has both portuguese and english as options. Clicking them will change the application language and store it in the localStorage, so the language choice persists when the user refreshes the page.

phiter commented 4 years ago

Could you break this functionality into smaller PR's?

I understand that to include this resource it required a lot of changes, but a PR with 65 files reduces cognitive assessment in review.

What do you think @juliemar , @angeliski n @alesshh ?

I can break it down in smaller PRs, however even though this PR has many file changes, most of them are simply replacing strings within components with i18n strings. This is going to happen only once, and github reviewing feature allows you to mark which files were already reviewed, so it can be reviewed for a longer time instead of all at once.

If you guys decide for smaller PRs, how would you suggest I break it down?

juliemar commented 4 years ago

I can break it down in smaller PRs, however even though this PR has many file changes, most of them are simply replacing strings within components with i18n strings. This is going to happen only once, and github reviewing feature allows you to mark which files were already reviewed, so it can be reviewed for a longer time instead of all at once. If you guys decide for smaller PRs, how would you suggest I break it down?

Hi @phiter, the best practice here is, for example, divide into a PR with add the i18n plugin, add functionally change language, translate login, translate, rooms, translate video conference.

What do you think?

phiter commented 4 years ago

I can break it down in smaller PRs, however even though this PR has many file changes, most of them are simply replacing strings within components with i18n strings. This is going to happen only once, and github reviewing feature allows you to mark which files were already reviewed, so it can be reviewed for a longer time instead of all at once. If you guys decide for smaller PRs, how would you suggest I break it down?

Hi @phiter, the best practice here is, for example, divide into a PR with add the i18n plugin, add functionally change language, translate login, translate, rooms, translate video conference.

What do you think?

Yeah that's doable, I'll start working on that.

juliemar commented 3 years ago

Hi @phiter can you fix the conflicts? or can you open a PR with the rooms internationalization?