public RouteTranslator AddTranslation(string url, string culture, LocalizationCollectionRoute route) { if (string.IsNullOrEmpty(culture)) { throw new ArgumentNullException("culture"); } if (route == null) { throw new ArgumentNullException("route"); } if (Configuration.ValidateCulture && Configuration.AcceptedCultures.All( acceptedCulture => !string.Equals(acceptedCulture, culture, StringComparison.CurrentCultureIgnoreCase))) { throw new InvalidOperationException(string.Format("AcceptedCultures does not contain culture '{0}'.", culture)); } route.AddTranslation(TransformUrl(url, culture, route), culture); if (Configuration.AttributeRouteProcessing == AttributeRouteProcessing.AddAsNeutralRouteAndReplaceByFirstTranslation) { // Remove neutral route route.RemoveTranslation(string.Empty); } return(this); }
public RouteTranslator AddNeutralTranslation(LocalizationCollectionRoute route) { route.AddTranslation(route.Url(), string.Empty); return(this); }