/// <summary> /// Retrieves a string resource for the specified culture using the resource map. /// </summary> /// <param name="name">The name of the string resource.</param> /// <param name="culture">The culture to retrieve a matching string for. May be <see langword="null"/>.</param> /// <returns>A localized string.</returns> internal static string GetResource(string name, CultureInfo culture) { Windows.ApplicationModel.Resources.Core.ResourceContext context; if (culture == null || culture.IsNeutralCulture) { context = Context; if (context == null) { context = Windows.ApplicationModel.Resources.Core.ResourceContext.GetForViewIndependentUse(); } } else { context = new Windows.ApplicationModel.Resources.Core.ResourceContext(); context.Languages = new string[] { culture.TwoLetterISOLanguageName }; } Windows.ApplicationModel.Resources.Core.ResourceCandidate resourceCandidate = ResourceMap.GetValue("NerdyDuck.Logging/Resources/" + name, context); if (resourceCandidate == null) { throw new ArgumentOutOfRangeException(nameof(name)); } return(resourceCandidate.ValueAsString); }
/// <summary> /// Retrieves a string resource using the resource map. /// </summary> /// <param name="name">The name of the string resource.</param> /// <returns>A localized string.</returns> internal static string GetResource(string name) { Windows.ApplicationModel.Resources.Core.ResourceContext context = Context; if (context == null) { context = Windows.ApplicationModel.Resources.Core.ResourceContext.GetForViewIndependentUse(); } Windows.ApplicationModel.Resources.Core.ResourceCandidate resourceCandidate = ResourceMap.GetValue("NerdyDuck.Scheduler/Resources/" + name, context); if (resourceCandidate == null) { throw new ArgumentOutOfRangeException(nameof(name)); } return(resourceCandidate.ValueAsString); }
/// <summary> /// Retrieves a string resource for the specified culture using the resource map. /// </summary> /// <param name="name">The name of the string resource.</param> /// <param name="culture">The culture to retrieve a matching string for. May be <see langword="null"/>.</param> /// <returns>A localized string.</returns> internal static string GetResource(string name, CultureInfo culture) { Windows.ApplicationModel.Resources.Core.ResourceContext context; if (culture == null || culture.IsNeutralCulture) { context = Context; if (context == null) { context = Windows.ApplicationModel.Resources.Core.ResourceContext.GetForViewIndependentUse(); } } else { context = new Windows.ApplicationModel.Resources.Core.ResourceContext(); context.Languages = new string[] { culture.TwoLetterISOLanguageName }; } Windows.ApplicationModel.Resources.Core.ResourceCandidate resourceCandidate = ResourceMap.GetValue("NerdyDuck.Logging/Resources/" + name, context); if (resourceCandidate == null) { throw new ArgumentOutOfRangeException(nameof(name)); } return resourceCandidate.ValueAsString; }