php-i18n icon indicating copy to clipboard operation
php-i18n copied to clipboard

How to handle when a term doesn't exists?

Open ppazos opened this issue 5 years ago • 1 comments

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.

ppazos avatar Dec 27 '19 18:12 ppazos

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.

Philipp15b avatar Jan 22 '20 16:01 Philipp15b