You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[ x ] There are no issues that match the desired change
[ x ] The change is large enough it can't be addressed with a simple Pull Request
Change
I am using CEL as a rule compute engine within my product. I have a need to be able to provide translated error messages to users and am wondering if there is any way for this to be accomplished in CEL. I am happy to inject the translation files in my code, if a mechanism exists.
Happy to submit a pull request if some pointers can be given.
Example Undeclared reference to 'test' (in container '')
Ideally, I would like to be able to translate messages of this sort.
Alternatives considered
N/A
The text was updated successfully, but these errors were encountered:
Hi @vivshankar, if you'd like to contribute here, I can offer you some advice for the parser and checker errors in a manner that permits the use of alternative language for the error message information. Would that work for your needs?
The runtime errors are in need of love and #25 and #189 are the specific changes that need to improve runtime stack traces and error messaging.
@vivshankar Thanks for being patient on this. I spent a little time thinking about this the other day and both the parser/errors.go and the checker\errors.go introduce an abstraction layer between the parser / checker and the common.Errors object. These minor abstractions introduce standard error messages and formats for each component.
My recommendation is as follows:
Introduce a Localizer interface in the common/localizer (new) package.
Establish constants for the existing English messages in common/localizer/codes.go and a mapping from the message id to a struct containing the localized message and the number of expected arguments to the message for the sake of linting. This first mapping for English can be in common/localizer/en_us.go
Create functional options for configuring the localizer for the parser and checker which adjust the localizer used when creating the parserErrors and checkerErrors objects.
This will probably take a bit of time to do, but the above is the rough idea. Please feel free to ask questions as you work through the code.
Feature request checklist
Change
I am using CEL as a rule compute engine within my product. I have a need to be able to provide translated error messages to users and am wondering if there is any way for this to be accomplished in CEL. I am happy to inject the translation files in my code, if a mechanism exists.
Happy to submit a pull request if some pointers can be given.
Example
Undeclared reference to 'test' (in container '')
Ideally, I would like to be able to translate messages of this sort.
Alternatives considered
N/A
The text was updated successfully, but these errors were encountered: