private string TryTranslate(TextTranslationDescriptor name) { if (name is null) { return(null); } if (translate) { return(localization.GetLocalized(name.Category, name.Id.ToString()) ?? name.Origin); } else { return(name.Origin); } }
public static void SetTranslatableRunSource(Run text, TextTranslationDescriptor descriptor) { if (descriptor is null) { text.Text = string.Empty; } else if (translate) { text.Text = localization.GetLocalized(descriptor.Category, descriptor.Id.ToString()) ?? descriptor.Origin ?? string.Empty; } else if (descriptor.PreferOrigin) { text.Text = descriptor.Origin ?? string.Empty; text.Language = "ja-jp"; } else { text.Text = localization.GetUnlocalized(descriptor.Category, descriptor.Id.ToString()) ?? descriptor.Origin ?? string.Empty; text.Language = "ja-jp"; } }