Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't escape carriage return #78

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

hishamco
Copy link
Member

Related to #76

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

@Skrypt
Copy link
Contributor

Skrypt commented Dec 15, 2023

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.

@hishamco
Copy link
Member Author

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

@Skrypt
Copy link
Contributor

Skrypt commented Dec 19, 2023

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.

@hishamco
Copy link
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants