OrchardCoreContrib.PoExtractor icon indicating copy to clipboard operation
OrchardCoreContrib.PoExtractor copied to clipboard

Don't escape carriage return

Open hishamco opened this issue 1 year ago • 5 comments

Related to #76

@Skrypt we could ignore \r instead of throwing an exception

hishamco avatar Dec 14 '23 19:12 hishamco

That would not work because the string would still be there in Orchard Core?

It would try to still find a string that has that \r\n

@S["Something\r\n"]

If you ignore it then that string will never match any translated PO string.

Skrypt avatar Dec 15 '23 01:12 Skrypt

That would not work because the string would still be there in Orchard Core?

Could you please elaborate?

It would try to still find a string that has that \r\n

There's no string in OC has \r\n

hishamco avatar Dec 16 '23 20:12 hishamco

OC or not. When you use the POExtractor it will extract strings in code. If you escape \r­ from the POExtractor then it will create a string in the resulting PO file that doesn't contain it. Which means that it will never match anything from your code.

@T["Something \r\n"] --> in your C# code will become

msgid "Something \n"

Then when you try to load translations it will try to find a matching string for "Something \r\n" still which will result in that string to never be translated unless you remove the "\r" from your code. Here, you need to warn the user that you found a "\r" in the code and that you escaped it else the user will never know about it.

Skrypt avatar Dec 19 '23 06:12 Skrypt

We might log a warning when the user is using \r only

hishamco avatar Dec 19 '23 09:12 hishamco