When using NativeArray (https://github.com/phalcon/cphalcon/blob/master/phalcon/translate/adapter/nativearray.zep) on a missing key, the key itself is returned if there's no translation for this key.
A warning should be raised to deal with such a situation, avoiding displaying keys on the production website. It's not a security issue, but that should help displaying what's intended.
I can create a pull request for this, just tell me if you have a specific implementation to follow: throw an exception (I see that you have Phalcon\Translate\Exception), passing a function...
And option would be exceptionOnMissingKey or anything you'd prefer, defaulting to false of course.
An exception may be too difficult to deal with, it should be a function:
new NativeArray(['content' => [], 'onMissingKey' => $myfunction]
The function may return the key, overriding the code:
https://github.com/phalcon/cphalcon/blob/master/phalcon/translate/adapter/nativearray.zep#L63
Example of function to pass:
function missingKey($key) {
trigger_error('Can\'t find translation key: '.$key);
return $key; // or better, return nothing with 芦return '';禄
}
This has been addressed
Most helpful comment
An exception may be too difficult to deal with, it should be a function:
new NativeArray(['content' => [], 'onMissingKey' => $myfunction]The function may return the key, overriding the code:
https://github.com/phalcon/cphalcon/blob/master/phalcon/translate/adapter/nativearray.zep#L63
Example of function to pass: