johaness/i19 — pull request #5 by glyphobet (2013-11-05 12:00:00+00:00)
Title: move fallback_default check into $i19.translate

The `i19.translate` function made available through the JavaScript via `$i19` would always return the empty string if there was no translation for the input. This meant that anything marked for translation in the JavaScript via `$i19("message")`, but not actually translated in the current language, would always appear as an empty string in the UI, regardless of whether `fallback_default` was set or not, or what the input string was.

The code that checked `translate.fallback_default` was spread over three places in the `i19` and `i19Attr` directives.

This moves that `fallback_default` check into `i19.translate`, which decouples the directives from `fallback_default` and allows strings translated via `$i19()` in the JavaScript to fall-back to the default input even from JavaScript.

The `i19` injected into the root scope is also simplified, as it no longer needs the extra `|| a` condition, since that's the default behavior of `i19.translate`.

It also would theoretically allow you to translate strings in JavaScript with msgids, like `$i19('message-id', undefined, "My Message in English")`.