Skip to content

refactor: port i18n utilities to typescript [#1526]

Marwan Zibaoui requested to merge 1526-i18n-js-to-ts into next

This is part of the work related to the epic Reorganize Files - Modernization, a.k.a move all the js files to the src folder.

This one is somewhat straightforward: take the js/i18n.mjs file, move it to src/i18n, port it to typecript. I did not do any refactor apart from adding types and updating imports.

I don't think it's very worthy to invest time in changing anything there. It seems that our i18n functionality is working fine. Two things that could be have been done as part of this MR that I decided against:

  1. Try to simplify/change the logic to make things easier to understand
    • As I said, things are working fine as is. "If it ain't broken don't fix it".
    • If we are to move to a UI library/framework, we'll probably revisit i18n entirely
    • There are no unit tests so I don't want to add logic changes because I don't know which edge case I should keep an eye out for
  2. Adding some unit tests
    • TBH I think we should just do it.
    • The logic of the module is pretty hard to understand, if anybody has a good understanding of what the functions are doing i'm happy to pair and write some unit tests together
    • Same reason as a above as regarding the fact that we might switch for a UI library sometime next year anyways

I tested this by rebuilding the extension and clicking around. Everything is looking good in English and I have no reason to believe that it should break for other languages.

Related to #1526 (closed)

Edited by Marwan Zibaoui

Merge request reports