How to have bullet points in an error message?
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: How to have bullet points in an error message?
If you like you can make your first PR so that it can be merged into master. Before doing so there are two other features with a similar meaningless error message: FeatureHole.cpp in line 952 and FeatureGroove.cpp in line 102.
- DeepSOIC
- Veteran
- Posts: 7896
- Joined: Fri Aug 29, 2014 12:45 am
- Location: used to be Saint-Petersburg, Russia
Re: How to have bullet points in an error message?
FaceMakerCheese is adapted face-making code of Part Extrude and PartDesign (same code was repeated in about three places I think). I called it "cheese" because it supports making faces with holes, but doesn't support islands inside holes. If you take a slice of cheese, it can have holes but can't have islands inside holes... That's why!
- DeepSOIC
- Veteran
- Posts: 7896
- Joined: Fri Aug 29, 2014 12:45 am
- Location: used to be Saint-Petersburg, Russia
Re: How to have bullet points in an error message?
Use html, maybe?
Re: How to have bullet points in an error message?
Thanks, creative, but not working for me. C++ may not be directly recognizing html, seems like Python does?
I guess it's related to what wmayer mentioned in his next to last reply.
Thanks, I'm very much tempted to change it to utf8. I'm guessing it shouldn't affect other errors that use this routine.
I'd like to try, if I can figure out the PR process with Git (so far I've only created a local branch - maybe I'll make things easier on myself and redo everything on Github's web UI!). I had already made the same change in FeatureHole.cpp, I hadn't thought of looking in FeatureGroove.cpp.
Ha! Thanks for the explanation, the Swiss cheese analogy did pass through my mind.
Re: How to have bullet points in an error message?
Success:
But it does not look nice without indentation, and with the text right beneath the bullet. I wanted to avoid forcing carriage returns because I thought the window could be resized by then end user, but it looks like its width is fixed.
But it does not look nice without indentation, and with the text right beneath the bullet. I wanted to avoid forcing carriage returns because I thought the window could be resized by then end user, but it looks like its width is fixed.
Re: How to have bullet points in an error message?
Better, but missing an empty line before the bullet list! Line breaks are not to my liking either.
- Attachments
-
- FC018_PD_error_message_enhancement_05.png (33.59 KiB) Viewed 1900 times
Re: How to have bullet points in an error message?
I think this is it.
What do you guys think?
Now, the big question is, how will this text string be translated? I mean, how will it appear on Crowdin: as it's shown above, or will the bullet points be shown as \xe2\x80\xa2
What do you guys think?
Now, the big question is, how will this text string be translated? I mean, how will it appear on Crowdin: as it's shown above, or will the bullet points be shown as \xe2\x80\xa2
Re: How to have bullet points in an error message?
That looks good. It is good to see that you have similar high aesthetic standards as I have. How does it look with another space (half a line would be nice, haha) between the bullet paragraphs?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: How to have bullet points in an error message?
Not at all because Qt's lupdate tool won't pick up the string because it's not marked accordingly. The string must be put inside the QT_TR_NOOP macro and then when it is about to be displayed QApplication::translate must be used.Now, the big question is, how will this text string be translated?
I guess that it will show the \xe2\x80\xa2. However, it's always a bit problematic if technical stuff is part of a string because some translators don't know what to do and simply omit it.I mean, how will it appear on Crowdin: as it's shown above, or will the bullet points be shown as \xe2\x80\xa2
IMO, the best practise to avoid such cases is that it's up to the programmers to split the whole string into two parts. The technical part that won't be marked for translation and the actual content that will be marked.
Code: Select all
/* TRANSLATOR PartDesign::Pocket */
Code: Select all
std::string message = QT_TR_NOOP("The requested feature cannot be created. The reason may be that:");
message += "\n\xe2\x80\xa2";
message += QT_TR_NOOP("the active Body does not contain a base shape, so there is no material to be removed");
message += "\n\xe2\x80\xa2";
message += QT_TR_NOOP("the selected sketch does not belong to the active Body.");
The code to display the error message should then be changed to (TaskDlgFeatureParameters::accept()):
Code: Select all
QMessageBox::warning(Gui::getMainWindow(), tr("Input error"), QApplication::translate(feature->getTypeId().getName(), e.what()));
- DeepSOIC
- Veteran
- Posts: 7896
- Joined: Fri Aug 29, 2014 12:45 am
- Location: used to be Saint-Petersburg, Russia
Re: How to have bullet points in an error message?
But will it work at all? I thought, Qt looks up the whole string in the translation library, but will not find it because only pieces are in the library?wmayer wrote: ↑Tue Dec 04, 2018 9:06 am...Code: Select all
std::string message = QT_TR_NOOP("The requested feature cannot be created. The reason may be that:"); message += "\n\xe2\x80\xa2"; message += QT_TR_NOOP("the active Body does not contain a base shape, so there is no material to be removed"); message += "\n\xe2\x80\xa2"; message += QT_TR_NOOP("the selected sketch does not belong to the active Body.");
The code to display the error message should then be changed to (TaskDlgFeatureParameters::accept()):Code: Select all
QMessageBox::warning(..., QApplication::translate(..., e.what()));