Welcome, Guest
Username: Password: Remember me

TOPIC: [SOLVED] Raise Exception when a term is missing?

[SOLVED] Raise Exception when a term is missing? 1 month 1 week ago #3223

  • impbox
  • impbox's Avatar
  • Offline
  • New Member
  • Posts: 2
  • Karma: 0
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: 4 weeks 1 day ago by impbox. Reason: Solved
The administrator has disabled public write access.

Raise Exception when a term is missing? 1 month 1 week ago #3224

  • Frank
  • Frank's Avatar
  • Offline
  • Administrator
  • Posts: 1129
  • Thank you received: 241
  • Karma: 70
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
The administrator has disabled public write access.

Raise Exception when a term is missing? 4 weeks 1 day ago #3239

  • impbox
  • impbox's Avatar
  • Offline
  • New Member
  • Posts: 2
  • Karma: 0
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.
The administrator has disabled public write access.
Time to create page: 0.221 seconds
Colors