* @param locales
* @param defaultLocale the default locale in case none of the supplied locales provide a match
* @return an ILocalizedElement, or null if there are no valid entries
*/
public static ILocalized getLocalizedElement(ILocalized[] elements, String[] locales, String defaultLocale){
ILocalized element = getLocalizedElement(elements, locales);
// If using the algorithm did not return ANY results, try again using defaultlocale
if (element == null && elements != null){
for(ILocalized elem:elements){
if (elem.getLang().equals(defaultLocale)) return elem;
}