matrix icon indicating copy to clipboard operation
matrix copied to clipboard

Adds internationalization

Open phiter opened this issue 3 years ago • 4 comments

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 avatar Jul 18 '20 20:07 phiter

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?

phiter avatar Jul 21 '20 14:07 phiter

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?

juliemar avatar Jul 21 '20 15:07 juliemar

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.

phiter avatar Jul 21 '20 16:07 phiter

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

juliemar avatar Oct 06 '20 01:10 juliemar