* @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 ILocalizedElement getLocalizedElement(ILocalizedElement[] elements, String[] locales, String defaultLocale){
ILocalizedElement element = getLocalizedElement(elements, locales);
// If using the algorithm did not return ANY results, try again using defaultlocale
if (element == null && elements != null){
for(ILocalizedElement elem:elements){
if (elem.getLang().equals(defaultLocale)) return elem;
}