feedback icon indicating copy to clipboard operation
feedback copied to clipboard

[BUG] links with special characters break after translation

Open mtdvlpr opened this issue 2 years ago • 8 comments

Summary

I have a link in my bug-feature.md file with liquid code: [GitHub Discussions]({{site.github}}/discussions).

When the bug-feature.md gets translated through Gitlocalize, it changes the link to: [GitHub Discussions](%7B%7Bsite.github%7D%7D/discussions). This breaks my links, which is pretty annoying if I have to manually fix it everytime someone translates a page.

Steps to reproduce

Have a Markdown file with a link that uses the { or } chars. Translate it through Gitlocalize, make a PR and see the proposed changes.

Repository URL

https://gitlocalize.com/repo/8177

What is the current bug behavior?

Gitlocalize changes the { and } chars to its unicode

What is the expected correct behavior?

Gitlocalize should properly parse special characters inside links and not change them.

Relevant logs and/or screenshots

Screenshot from 2022-11-18 09-35-40

Possible fixes

(If you have any idea to solve the problem, please help us.)

mtdvlpr avatar Nov 18 '22 08:11 mtdvlpr

@mtdvlpr Thank you for reporting this! We'll try to find the way to keep urls the same as in the original file.

svasilenkov avatar Nov 18 '22 19:11 svasilenkov

@svasilenkov, I now also noticed that greater than signs (>) are changed to >. This occurs everywhere in the file, not just in links. Could this also be fixed?

mtdvlpr avatar Dec 22 '22 19:12 mtdvlpr

@svasilenkov, another one I just experiences: some special markup gets changed to html tags. Italic using _text_ gets transformed to <em data-md-type="emphasis">text</em> and the same thing happens to some code blocks and strong text.

mtdvlpr avatar Dec 24 '22 13:12 mtdvlpr

@mtdvlpr Could you please give us links to the files illustrating the problems?

svasilenkov avatar Dec 26 '22 14:12 svasilenkov

This page has the generated code, em and strong blocks: https://github.com/mtdvlpr/meeting-media-manager/blob/gitlocalize-bugs/locales/pt/_posts/2022-08-17-configuration.md

mtdvlpr avatar Dec 26 '22 14:12 mtdvlpr

This page has the > characters converted to &gt: https://github.com/mtdvlpr/meeting-media-manager/blob/gitlocalize-bugs/locales/nl/_posts/2022-08-17-present-media.md`

mtdvlpr avatar Dec 26 '22 14:12 mtdvlpr

@svasilenkov, the problems mentioned above are not ideal, but also not breaking. The pages are correctly rendered. The original problem ({ and } converted into %7B and %7D) is a problem, because it breaks the links that are supposed to be generated based on variables. An example of that problem is the following file: https://github.com/mtdvlpr/meeting-media-manager/blob/gitlocalize-bugs/locales/nl/_posts/2022-08-17-bug-feature.md

mtdvlpr avatar Dec 26 '22 14:12 mtdvlpr

@mtdvlpr Thank you so much for the examples. I've added the issue in our todo list.

svasilenkov avatar Dec 27 '22 16:12 svasilenkov