vkbo / novelWriter

novelWriter is an open source plain text editor designed for writing novels. It supports a minimal markdown-like syntax for formatting text. It is written with Python 3 (3.9+) and Qt 5 (5.15) for cross-platform support.
https://novelwriter.io
GNU General Public License v3.0
1.96k stars 99 forks source link

Multi language books #1869

Open julichan opened 2 months ago

julichan commented 2 months ago

Hello,

I think it would be great to have multi language support when you are writting a book in multiple languages. off course today, it s possible to run two instances of novel writter side by side for each translation but i think it'd be better handled by novel writter.

I think each language would be new files in the content folder and the structure might need either a root node per language containing all existing nodes or each node of the structure would simply reference a new file per languages. Two files could easily be put side by side just like we can see markdown on one side and the rendered documents today but we would choose either markdown or wisiwig editors and the language on each side while we write the translation.

I can polish my idea but what do you think of this ?

vkbo commented 2 months ago

It's been discussed a bit before, like for instance here: https://github.com/vkbo/novelWriter/issues/1541#issuecomment-1898768397

I'm positive to this. Due to the way the spell checker in handled (third party library), which takes a single dictionary, it would not be trivial to spell check multiple languages. The third party library uses some singleton setup that may require internal reloads for changing language.

However, marking certain regions or entire documents as a different language and have the spell checker ignore them of the language doesn't match, wouldn't be too difficult. The spell check language can easily be switched from the Tools menu now, so a first iteration like this isn't too difficult to implement. It would also be easy enough to handle on export to ODT format where multiple spell checkers are available.

julichan commented 2 months ago

Marking certain regions as non translatable at all would be good too. Tolkien created his own language and that wouldn't quite work with a spell checker i guess.

vkbo commented 2 months ago

With the [lang:<code>] syntax proposed you can just set the <code> to something that isn't valid, like none, and it should ignore it. It would only activate spell checking if the code matches the spell checked language.

peter88213 commented 2 months ago

By the way, with ODT, the language code for "no language" is "zxx" and the country code is "none". The combined locale code would therefore be "zxx-none" instead of "en-US", for example.

See also ISO 639, where "zxx" is for "No linguistic information at all".