[Feature request] Add ability to easily translate some phrases

Hi,
I’m using CodeMirror for a web app in French. And every time I made an upgrade of the search add-on for example, I need to manually change the phrases like Replace, Replace all, With, input placeholder, etc. in the search.js file.

Can you add an option (translation: object) to make translation of phrases easier and programmatic?
The option could be handled like something like this:

editor.setOption("translation", {
  "replace": "Remplacer",
  "replace-all": "Remplacer tout",
  "with": "Par",
  "editorPlaceholder": "Votre code JavaScript"
  // etc.
});

// or 
editor.setOption("translation", {
  "replace": i18n[lang].replace,
  "replace-all": i18n[lang]["replace-all"],
  "with": i18n[lang].with,
  "editorPlaceholder": i18n[lang].editorPlaceholder
  // etc.
});

Thanks.

See the phrases facet.

OK, that’s great, but I’m speaking about the 5th version (if it’s conceivable).

Ahh, sorry, that has a similar phrases option.

1 Like

Thank you very much :tada:. That’s what I was looking for.