U4-10990 - Translation fallback last resort should be hardcoded string in the angular view

Created by Sebastiaan Janssen 20 Feb 2018, 08:53:24 Updated by Sebastiaan Janssen 27 Jun 2018, 06:33:09

Tags: Up For Grabs

Currently when a translation doesn't exist in the language the backoffice user is logged in as, we ultimately look in the en.xml file to get the translation there. If it doesn't exists in en.xml, we only show the translation key. However, since in most cases there's a perfectly valid default value in the html view itself, we should fall back to that to make it less ugly and to be less dependent on the en.xml file being updated. A lot of times people forget to update that file when upgrading so we could make it a bit less confusing by just showing the hardcoded default.


Nathan Woulfe 27 Jun 2018, 02:13:14

@sebastiaan is this with regard to the localize element directive only? Can't see how it could be made to work for the attribute localization, since there's no fallback in the markup.

I can push up a PR for the element directive, to fall back to the view value if one exists, otherwise displaying the translation key as a last resort (it's a bit cleaner than using the returned value as it omits the brackets).

If the view value is an Angular binding (like it would be for button group), I think I'd just assume that the value will come from the javascript and always exist.

I don't think it would be foolproof, but provided the directive has a value in the markup, would work fine.

Sebastiaan Janssen 27 Jun 2018, 06:33:05

@NathanWoulfe I've actually changed my mind since creating this, it's actually very helpful to see the translation key when you're developing and it's also a nudge to upgraders that they forgot files. I think it's fine to leave it for now, thanks for looking into it!

Priority: Normal

Type: Feature (request)

State: Closed


Difficulty: Easy


Backwards Compatible: True

Fix Submitted:

Affected versions:

Due in version:


Story Points: