Translating ProseMirror

I’m looking into translating ProseMirror for use in an international system and figuring out the best way to accomplish this. Perhaps the easiest way would be to pass an optional function :: string -> string which will wrap all labels and prompts.

Have you thought anything about this or is there a roadmap, @marijn?

This is something that I haven’t put much thought into. My plan was to, at some point, add a wrapper like that, but I’m not sure whether it should be global or per-editor-instance. What do you think?

I think you would supply an optional translate-function in the config params when initializing an editor, which will take a string and optionally more args, and return a string. If no such function is supplied, it’s just the identity function.

It might become difficult though, depending on how complicated strings are (parameters, pluralization and such). An other option would be to add a translation function and just let users supply mappings for their language instead.

Actually that’s probably better. Have a key for each label and string, and refer to those in translation files.

I think this is a fairly common problem with lots of existing solutions, i.e. https://www.npmjs.com/package/i18n