Closed vcraescu closed 5 years ago
@vcraescu Currently function returns empty string and logs key not found as a warning.
https://github.com/go-aah/aah/blob/0bb36e017ede1b452eb1aa8c256bd5a7860b2563/i18n/i18n.go#L149-L151
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.: ???key.not.found???
@jeevatkm Key should be enough. That's how most of the translators are implemented at least in PHP world :smile:
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 :smile:) 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! :+1:
@vcraescu You're welcome. You could try the implementation and please share your feedback.
Add to go.mod
replace aahframe.work => aahframe.work v0.0.0-20190111183604-b1a2826abfb3
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.