public static string ToLocalizedString( this IPersonName personName, PersonNameFormatterStyle style = PersonNameFormatterStyle.Default, bool usePhoneticRepresentation = false) { #if UNITY_IOS && !UNITY_EDITOR var jsonString = JsonStringForPersonName(personName); return(PInvoke.AppleAuth_IOS_GetPersonNameUsingFormatter(jsonString, (int)style, usePhoneticRepresentation)); #else var orderedParts = new System.Collections.Generic.List <string>(); if (string.IsNullOrEmpty(personName.NamePrefix)) { orderedParts.Add(personName.NamePrefix); } if (string.IsNullOrEmpty(personName.GivenName)) { orderedParts.Add(personName.GivenName); } if (string.IsNullOrEmpty(personName.MiddleName)) { orderedParts.Add(personName.MiddleName); } if (string.IsNullOrEmpty(personName.FamilyName)) { orderedParts.Add(personName.FamilyName); } if (string.IsNullOrEmpty(personName.NameSuffix)) { orderedParts.Add(personName.NameSuffix); } return(string.Join(" ", orderedParts)); #endif }