replied on August 19, 2019
The field languages can be retrieved with the Field.GetExtendedProperties method, here is some sample code:
List<PropValue> propertyNames = new List<PropValue>();
propertyNames.Add(new PropValue()
{
Name = "LF:Name",
Namespace = "http://laserfiche.com/namespaces/cr/fields/"
});
// Get all field extended properties
List<PropResponse> AllFieldProperties = Field.GetExtendedProperties(propertyNames, session);
Dictionary<string, Dictionary<string, string>> localizedNameDict = new Dictionary<string, Dictionary<string, string>>();
foreach (PropResponse response in AllFieldProperties)
{
if (response.PropStat[0].Status.Contains("200"))
{
string fieldUrl = System.Web.HttpUtility.UrlDecode(response.Href);
// Strip off the +LF/prop/
int index = fieldUrl.IndexOf("+LF/prop/") + 9;
string fieldName = fieldUrl.Substring(index);
localizedNameDict[fieldName] = new Dictionary<string, string>();
foreach (PropValue propVal in response.PropStat[0].Props)
{
// Parse the extended properties to get the localized names
List<string> segments = propVal.Value.Split(new[] { '\r', '\n' }).ToList();
segments.RemoveAll(item => String.IsNullOrEmpty(item));
foreach (string prop in segments)
{
// Each line looks like this:
// en=English Name
// fr=French Name
var split = prop.IndexOf('=');
if (split == -1)
continue;
string languageCode = prop.Substring(0, split).Trim().ToLower();
string localizedName = prop.Substring(split + 1).Trim();
// Add this localized name to the dictionary
localizedNameDict[fieldName][languageCode] = localizedName;
Console.WriteLine($"{fieldName}-{languageCode}: {localizedName}");
}
}
}
}