Make strings translatable#111
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughIn 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
dec7cd7 to
4081614
Compare
4081614 to
0c1c1a8
Compare
|
Anything wrong on this? |
| m_xml->result.status = pugi::status_internal_error; | ||
| m_xml->customErr = String(u"unknown encoding"); | ||
| m_xml->customErr = mtrc("global/serialization", "Unknown encoding"); | ||
| LOGE() << m_xml->customErr; |
There was a problem hiding this comment.
I think that localizing internal errors of utility classes (like this one) is not the best solution.
We won't be able to figure out what the error is in the log (for example, if it's in Chinese)
It would be nice to:
- Add or improve error codes
- Generate error text somewhere in the business logic using the available information (e.g. "The palette configuration file is incorrect", or whatever we're reading there.)
There was a problem hiding this comment.
It isn't as internal as you'd think: I've see it in the UI, in a MuseScore dialog, see #110
BTW: any idea why the unit test fails?
There was a problem hiding this comment.
It isn't as internal as you'd think: I've see it in the UI, in a MuseScore dialog, see #110
We need to fix these places - make a message based on the error code.
And not display a message from the utility class. That's the same as if we were displaying an error from QXmlStreamReader::errorString
BTW: any idea why the unit test fails?
There was a problem with dependencies, you need to update from main
There was a problem hiding this comment.
- Problem with that: it (
XmlStreamReader::setData()) seems to be called via a constructor (XmlStreamReader::XmlStreamReader), not directly, not in this case at least (it is not a MusicXML import nor about a palette, nor a Mu2 score), but on reading a .mscz file which contained binary junk only. - OK, rebasing now. Edit: doesn't help
There was a problem hiding this comment.
We could do this:
m_xml->customErr = mtrc("global/serialization", "Empty document");
LOGE() << "Empty document");Have it translated in the UI and untranslated in the logs
There was a problem hiding this comment.
I think it's better to make the error text in the business logic rather than in the utility class, because:
- We can change the implementation of a utility class and replace it with a third-party implementation.
- In a specific place, a more accurate message can be making that is specific to that place.
- The error text from the utility class is often used for internal purposes (write to the log, write somewhere...) and not for the user.
- And it would be better to remove the log output here. An empty document isn't always an error... it depends on the context.
There was a problem hiding this comment.
Ok that's nothing I think I could do, so feel free to close this PR
Resolves: #110