SimonXIX / Markdown_translation

a script and Docker environment for running automated open source translations of batches of Markdown files using LibreTranslate
GNU Affero General Public License v3.0
6 stars 1 forks source link

enhacement: options to deal with code blocks in the markdown documents #3

Open villares opened 4 months ago

villares commented 4 months ago

In my experience, code blocks/snippets/examples embedded in markdown docs have been poorly translated. Could we try something to improve this? Maybe a flag and a strategy to skip translating code?

SimonXIX commented 4 months ago

I've taken a first step towards this by adding code to strip out text in code blocks and to replace it in the translated text after translation. This works for most languages although there may be some (like Portuguese) where LibreTranslate translates the placeholders that the script inserts and so never replaces the original text after translation.

villares commented 4 months ago

Thank you! I'll try to test it when I have the chance! I might try to replace __PLACEHOLDER_ with __P_ to see if it helps :smiling_face_with_tear: