-
Notifications
You must be signed in to change notification settings - Fork 116
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
Log should not be i18n #2477
Comments
Thank you for bringing this up. I'm in favor of this change, and currently many of Pulp's log strings are wrapped with |
I'm also in favor of this, there have been times where |
If there is a need to translate logs, that probably would be a task for the log handler to perform this lazily. On code we just emit the raw log. |
+1 to this change too |
With this issue I plan to do two things:
|
In looking at fixing this, the log statements are very clear, but the error messages which produce tracebacks are difficult. What do I do in these 3 cases?
|
Errors raised in views and viewsets are usually handled by the rest framework (https://www.django-rest-framework.org/api-guide/exceptions/). I would get rid of i18ln only for errors that result in an HTTP 500 response. Regarding the tasking system, I believe that once the user's data successfully pass through the validation provided by serializers, we are safe to state that there was no user fault. Everything that goes beyond the stage of the Pulp API, should not be translated. If an error occurs during the runtime of a task, then there might be a problem in Pulp that needs attention from an administrator. Thus, no i18ln is required in this case. Here is what I did for pulp_container: https://github.com/pulp/pulp_container/pull/708/files. However, there might be a scenario where a user wants to re-sync her repository. If the remote will not be accessible, the corresponding task will fail during the runtime. Here, we would like to provide a translated error message in the task's details. So, the real question is whether we should differentiate between particular types of task errors or not. 🤷♂️ |
In general this is a great Idea. To me for example it is very annoying that URL not found (a clear misconfiguration of the remote by the user) produces half a kilometer of stacktrace both in the logs as well as in the task report. |
Exactly! Some of the errors are raised in a very inappropriate place. I suggest first removing i18ln from all tasks. Once we move all the validation to the right place (e.g., serializers), then we may proceed with adding the support for translations. |
Thanks for all the discussion. There are hundreds of instances to look through so for time/benefit reasons I'm going to focus on removing the log i8ln in this PR and also document that as the official policy. I believe of the i8ln string used in exception messages those exclusive to tasks will be the minority so for me it's not worth it. I'll make that PR now. |
i8ln should only be for using facing strings. This updates the code as best as I could tell the difference, and also documents that expectation for plugin writers. closes pulp#2477
i8ln should only be for using facing strings. This updates the code as best as I could tell the difference, and also documents that expectation for plugin writers. closes pulp#2477
i8ln should only be for using facing strings. This updates the code as best as I could tell the difference, and also documents that expectation for plugin writers. closes pulp#2477
il8n should only be for using facing strings. This updates the code as best as I could tell the difference, and also documents that expectation for plugin writers. closes pulp#2477
il8n should only be for using facing strings. This updates the code as best as I could tell the difference, and also documents that expectation for plugin writers. closes pulp#2477
il8n should only be for using facing strings. This updates the code as best as I could tell the difference, and also documents that expectation for plugin writers. closes #2477
Currently logs are being translated (passed by gettext
_
) and that causes log messages to be internationalizable and that is a problem.Statement
The audience for logs are developers, system administrators, auditors, testers and as the main project documentation + code are in English we expect logs to be consistent.
Logging analysis tools would expect log levels (ERROR, CRITICAL, DEBUG, INFO) etc to be in english and there are some tools that might do some deeper linguistic analysis on logs.
Bad scenario
Assuming a system that is installed for a Brazilian company and the whole system messages on the front-ends (API, UI, CLI) are well translated, and that is expected!
Now on that system there is a problem and the user open an issue, the developer or tester asks the user to upload the latest log file and the developers, testers, administrators are going to get messages like:
Or if the system is in chinese
As we don't have a table of standard error codes, it will be very difficult and costly for support to troubleshoot the issue.
It is better to keep in English as it is the standard lang for I.T support.
Conclusion
Only front-ends must be translated.
The text was updated successfully, but these errors were encountered: