It's possible with Neural Machine Translation models. Before being integrated into Firefox itself local translation was already available through the TranslateLocally add-on, see: https://browser.mt/
It has been possible for quite some time. I remember a few years ago, Google Translate offered a offline translation option (for a specific language pair) on my Android that required a couple hundred of MBs of download.