X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.util%2Fsrc%2Forg%2Fargeo%2Futil%2Fdirectory%2Fldap%2FLdapEntry.java;h=823bc9502e6eb9a57c9e51e6d381c9c29b94f9c8;hb=a2282a88386d907502ff29c3d6c89550331feeff;hp=f34de7eb5022f5ed6b7f7603b801c3cca30898c2;hpb=70f045c8ca8dbbd117d5a80ff57975069641079a;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.util/src/org/argeo/util/directory/ldap/LdapEntry.java b/org.argeo.util/src/org/argeo/util/directory/ldap/LdapEntry.java index f34de7eb5..823bc9502 100644 --- a/org.argeo.util/src/org/argeo/util/directory/ldap/LdapEntry.java +++ b/org.argeo.util/src/org/argeo/util/directory/ldap/LdapEntry.java @@ -4,6 +4,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.Dictionary; import java.util.List; +import java.util.Locale; import java.util.Set; import java.util.StringJoiner; import java.util.TreeSet; @@ -42,4 +43,14 @@ public interface LdapEntry { currentObjectClasses.forEach((s) -> values.add(s)); properties.put(LdapAttrs.objectClasses.name(), values.toString()); } + + public static Object getLocalized(Dictionary properties, String key, Locale locale) { + if (locale == null) + return null; + Object value = null; + value = properties.get(key + ";lang-" + locale.getLanguage() + "-" + locale.getCountry()); + if (value == null) + value = properties.get(key + ";lang-" + locale.getLanguage()); + return value; + } }