[SOLVED] Raise Exception when a term is missing?

More
5 years 6 months ago - 5 years 6 months ago #3223 by impbox
Hi,

I've just started using I2 Localization, however when I SetTerm to a term that doesn't yet have an entry, there's no indication that there's a problem to resolve, it seems to silently fail and leave the default text.

Is there a way to detect which terms have been set while running but don't have entries or translations?

Thanks!
Last edit: 5 years 6 months ago by impbox. Reason: Solved

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

More
5 years 6 months ago #3224 by Frank
Hi,
Setting an invalid term is also useful sometimes and the plugin handles them a bit differently.

When you set a term, the Localize component looks it up in one of the LanguageSources you created. If its found, then its translation is used, parameters, plurals, etc.

However, when the term is empty or can't be found, then the plugin tries to infer it from the label it is trying to localize. It takes the text of the label and see if there is a term with that name, if so, it uses that term.
That its very useful when you are setting your translations, given that you can select all your labels, add a Localize component to them, and without setting a term for each of them, the plugin finds automatically the corresponding term based on the text. (e.g. if the label reads "Play", then it finds for that in the LanguageSource and replaces the text for its translation to the current language)
This is also useful when you are changing the term dynamically using a 3rd party plugin that only knows how to modify the Label's text (e.g. Flow Dialogs and other similar plugins). In that case, you just set the term to empty, and as soon as someone modifies the label's text, it uses that as the term name.

Said that, there is a way to override that behavior:
In the Language's Tab there is a popup for selecting what should happen when a term is missing:
www.inter-illusion.com/forum/i2-localiza...-notes?start=24#1670


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.

More
5 years 6 months ago #3239 by impbox
Sorry I took so long to reply! Thanks very much for that!

I didn't realise that would help because I was concerned about the Term being missing rather than the Translation, but this works for both.

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

Time to create page: 0.199 seconds
Template by JoomlaShine