Translation key existence

More
2 months 3 weeks ago #3562 by elusiven
Hi is there a way to check before getting translation via script localization that it exists so that I can perform my own kind of fallback?

Please Log in or Create an account to join the conversation.

More
2 months 3 weeks ago #3565 by Frank
Replied by Frank on topic Translation key existence
Hi,
You can use:
TermData term = LocalizationManager.GetTermData( termName );
if (term==null)
{
  // There is no term named termName
}

If you also want to check if the term exist but is not translated to the current language:
string translation;
bool termExists = LocalizationManager.TryGetTranslation(termName, out translation );
if (!termExists || translation==null)
{
  // There is no term named termName or there is no translation to the current language
}

Hope that helps,
Frank

Are you :-) Give I2L 5 stars!
Are you :-( Please lets us know how to improve it!
To get the betas as soon as they are ready, check this out

Please Log in or Create an account to join the conversation.

Time to create page: 0.148 seconds
Template by JoomlaShine