-
Notifications
You must be signed in to change notification settings - Fork 33
I18n.Lookup return value #237
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
Comments
@vcraescu Currently function returns empty string and logs key not found as a warning. Lines 149 to 151 in 0bb36e0
I thought log message would be enough for key not found cases. Seems like its not. I have a question for you: just a key should be returned or key with some wrapped value. e.g.: |
@jeevatkm Key should be enough. That's how most of the translators are implemented at least in PHP world 😄 Is very helpful when you need to display a text but you don't know if it's a translation key or just a value. There are cases when you would put a translation key into a db field (fast translatable entities 😄) and sometimes you just need to display the value as it is. If the translation function returns the key if no translation found it makes possible to create generic template function which will display either the translation or the raw value. Not very good at explaining stuff just hope it makes sense. |
@vcraescu understood 😄 |
Its done 😄 |
thanks! 👍 |
@vcraescu You're welcome. You could try the implementation and please share your feedback. Add to go.mod
|
Lookup function should return the key value if there's no translation for that key. Much easier to debug and there are cases when you need that where you pass a string to that method which is a translation key or just need to print it. There's no way to check if a translation key is valid or not.
The text was updated successfully, but these errors were encountered: