php-i18n
php-i18n copied to clipboard
How to handle when a term doesn't exists?
When a term doesn't exists I'm getting an exception "Fatal error: Uncaught Error: Undefined class constant".
It happens when two lang files exist but one has missing translations.
Yes, if the translation string is not available in a language file then the class does not contain the corresponding string. This is intended behaviour.
You could check if a term is defined in the current language using something like PHP's defined. Hope that helps.