browsermt/bergamot-translator

Make message objects have a JSON to/from

jerinphilip opened this issue · 0 comments

There are few message objects active in bergamot-translator. To name a few that currently exist:

  1. TranslationModel::Config (Ptr<Options> parsed from std::string)
  2. Service::Config (cpp struct only)
  3. ResponseOptions (cpp struct; was offered as a WASM binding (#140) and YAML parsing (#141), both of which abandoned). Currently extension has no way of controlling this, despite being available for so long.
  4. Response: There is no reason why Response can't have a JSON representation as well. After-all it is for consumption of a platform like WebAssembly/JS Extension. Coupled with a tool like jq, it'll be easy to develop ahead for use-cases mentioned in XapaJIaMnu/translateLocally#51 (comment). I would be a potential consumer.

In addition, having the from/to JSON functionalities can potentially make dropping WebAssembly worker at some point in an already available extension code and instead communicating with Native-Messaging easier, should someone with interest in faster translations and more native experimentation switch to such a setting.