This is exactly what I experience, but i tseems completely independent from the language in which a message is shown.chennes wrote: ↑Fri May 19, 2023 3:58 pm whether it is better for the error message to make direct sense to you (in your native language) so you have a chance to correct whatever is wrong, or whether the error message is "universal" so that you don't even try to understand it, you just hit Google immediately. I suppose this is one of the reasons that "error codes" have stuck with us.
Translating error messages in SketchObjectPyImp.cpp
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: Translating error messages in SketchObjectPyImp.cpp
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: Translating error messages in SketchObjectPyImp.cpp
@chrisb what is your preference here: for translated error messages, or for the message to be in English?
Re: Translating error messages in SketchObjectPyImp.cpp
I would go for the English version. I mean we are not Microsoft or Apple, and even they did not yet get this completely fixed. We know by now that 3D modeling cannot be learned by clicking around and thus it can be seen as a detail to be learned how to handle error messages.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: Translating error messages in SketchObjectPyImp.cpp
I am not sure I am understanding it in full.
Are we referring to using English in the Report View or to using English in the UI dialogs/Notification area?
For me the ReportView is just a view showing a log.
There is this other related issue running in GH:
https://github.com/FreeCAD/FreeCAD-tran ... issues/223
I think it is important we make a decision to this topic, or any solution we find may be suboptimal.
Are we referring to using English in the Report View or to using English in the UI dialogs/Notification area?
For me the ReportView is just a view showing a log.
There is this other related issue running in GH:
https://github.com/FreeCAD/FreeCAD-tran ... issues/223
I think it is important we make a decision to this topic, or any solution we find may be suboptimal.
Re: Translating error messages in SketchObjectPyImp.cpp
I was rather referring to report view. For popups, I can imagine to show both: a translated message and a button showing the untranslated version. This button would be suppressed if no translation exists, to avoid something similar to the messages in report view, which ask for checking report view.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: Translating error messages in SketchObjectPyImp.cpp
I fully agree with this. IMO we should only translate text for things that a user interacts with, like a dialog or the notification area. The report view isn't something the user interacts with.I have the idea that we do not translate messages that are reported in the report view.
As already pointed out in this thread if somebody asks for help then it's important to easily locate the source code for a given message/warning/error and if really everything is translated this will become very difficult.
This doesn't mean that they shouldn't be translated when showing them in a dialog or the notification area.This is mostly messages triggered from the App part of FreeCAD (not the Gui part)
One way is to use placeholders in the string. With the recently added fmt library this should be very easy now.One problem starts when we have dynamically generated strings, such as this code (from SketchObjectPyImp.cpp):
Code: Select all
fmt::format(QT_TRANSLATE_NOOP("Exception", "Datum {} for the constraint with index {} is invalid"), (const char*)Quantity.getUserString().toUtf8(), Index);
Re: Translating error messages in SketchObjectPyImp.cpp
I thought of this (although storing the printf format string instead of the fmt::format one).wmayer wrote: ↑Tue May 23, 2023 10:58 amOne way is to use placeholders in the string. With the recently added fmt library this should be very easy now.One problem starts when we have dynamically generated strings, such as this code (from SketchObjectPyImp.cpp):What we then need is a structure that stores the format string and the arguments so that the actual string can be regenerated and translated if needed.Code: Select all
fmt::format(QT_TRANSLATE_NOOP("Exception", "Datum {} for the constraint with index {} is invalid"), (const char*)Quantity.getUserString().toUtf8(), Index);
As we need this in one python exception, we would need a pair of c++/python exceptions that can store the arguments as a Python dictionary and then, when creating the c++ exception from the python one (in Interpreter.cpp), store them in the c++ one, so that when caught it can be processed. In fact, the c++ exception could have methods to retrieve an non-localised and a localised version of it.
Did I get your idea right? BTW, is there any advantage (other than possibly performance), from using the fmt syntax as opposed to printf syntax?
The simpler yet way less flexible alternative to this that I have thought, is to create a new exception pair "ErrorCodeError", which stores an error code. This means duplicating the strings at both ends which are only related by the error code. I do not like the error-code to string association, and the duplication. It is by far not very maintainable.
Re: Translating error messages in SketchObjectPyImp.cpp
Safety, simplification and portability.BTW, is there any advantage (other than possibly performance), from using the fmt syntax as opposed to printf syntax?