79696655

Date: 2025-07-10 07:31:57
Score: 1.5
Natty:
Report link

Thanks for sharing your solution! Just a quick note for others who might run into this, this behavior happens because XML treats \n as a literal backslash + n unless it's parsed or replaced explicitly in code. Flutter's tr() function doesn't interpret escape sequences like \n when reading from plain XML text.

Your workaround using replaceAll("\\n", "\n") is a solid and clean fix, especially when you're maintaining centralized localization formatting. Just be mindful if your translations ever include actual backslashes, as this could cause unintended replacements. In JSON-based localization, this issue often doesn't come up since escape sequences are handled more naturally.

Hope this helps someone in the same boat!

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Blacklisted phrase (2): Thanks for sharing
  • Whitelisted phrase (-1): Hope this helps
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Ronika Kashyap