/// <summary>
 /// Call like this Translator{Properties.Resources}.Translate(nameof(Properties.Resources.SomeKey));
 /// </summary>
 /// <param name="key">Path to the key. Must be included <typeparamref name="TResources"/>.</param>
 /// <param name="culture">The culture, if null CultureInfo.InvariantCulture is used</param>
 /// <param name="errorHandling">Specifies how errors are handled.</param>
 /// <returns>The key translated to the <paramref name="culture"/></returns>
 public static string Translate(string key, CultureInfo culture, ErrorHandling errorHandling)
 {
     return(Translator.Translate(ResourceManager, key, culture, errorHandling));
 }
Exemple #2
0
 /// <summary>
 /// Translator.Translate(Properties.Resources.ResourceManager, nameof(Properties.Resources.SomeKey));
 /// This assumes that the resource is something like 'Value: {0}' i.e. having one format parameter.
 /// </summary>
 /// <typeparam name="T0">The type of <paramref name="arg0"/> generic to avoid boxing</typeparam>
 /// <typeparam name="T1">The type of <paramref name="arg1"/> generic to avoid boxing</typeparam>
 /// <param name="key">The key.</param>
 /// <param name="arg0">The argument will be used as first arguyment in string.Format(culture, format, <paramref name="arg0"/>, <paramref name="arg1"/>)</param>
 /// <param name="arg1">The argument will be used as second argument string.Format(culture, format, <paramref name="arg0"/>, <paramref name="arg1"/>)</param>
 /// <param name="errorHandling">Specifies how to handle errors.</param>
 /// <returns>The key translated to the <see cref="Translator.CurrentCulture"/></returns>
 public static string Translate <T0, T1>(string key, T0 arg0, T1 arg1, ErrorHandling errorHandling = ErrorHandling.Default)
 {
     return(Translator.Translate(ResourceManager, key, Translator.CurrentCulture, arg0, arg1, errorHandling));
 }
Exemple #3
0
 /// <summary>
 /// Translator.Translate(Properties.Resources.ResourceManager, nameof(Properties.Resources.SomeKey));
 /// This assumes that the resource is something like 'Value: {0}' i.e. having one format parameter.
 /// </summary>
 /// <typeparam name="T">The type of <paramref name="arg0"/> generic to avoid boxing</typeparam>
 /// <param name="key">The key in</param>
 /// <param name="culture">The culture.</param>
 /// <param name="arg0">The argument will be used as string.Format(format, <paramref name="arg0"/>)</param>
 /// <param name="errorHandling">Specifies how to handle errors.</param>
 /// <returns>The key translated to the <paramref name="culture"/></returns>
 public static string Translate <T>(string key, CultureInfo culture, T arg0, ErrorHandling errorHandling = ErrorHandling.Default)
 {
     return(Translator.Translate(ResourceManager, key, culture, arg0, errorHandling));
 }
Exemple #4
0
 /// <inheritdoc />
 public string Translate(CultureInfo culture, ErrorHandling errorHandlingStrategy = ErrorHandling.Inherit)
 {
     return(Translator.Translate(this.resourceManager, this.Key, culture, errorHandlingStrategy));
 }
Exemple #5
0
 /// <summary>
 /// Translator&lt;Properties.Resources&gt;.Translate(nameof(Properties.Resources.SomeKey__0__,));
 /// This assumes that the resource is something like 'Value: {0}' i.e. having one format parameter.
 /// </summary>
 /// <typeparam name="T">The type of <paramref name="arg0"/> generic to avoid boxing.</typeparam>
 /// <param name="key">The key in.</param>
 /// <param name="arg0">The argument will be used as string.Format(format, <paramref name="arg0"/>).</param>
 /// <param name="errorHandling">Specifies how to handle errors.</param>
 /// <returns>The key translated to the <see cref="Translator.Culture"/>.</returns>
 public static string?Translate <T>(string key, T arg0, ErrorHandling errorHandling = ErrorHandling.Inherit)
 {
     return(Translator.Translate(ResourceManager, key, Translator.CurrentCulture, arg0, errorHandling));
 }
Exemple #6
0
 /// <summary>
 /// Call like this Translator&lt;Properties.Resources&gt;.Translate(nameof(Properties.Resources.SomeKey));.
 /// </summary>
 /// <param name="key">Path to the key. Must be included <typeparamref name="TResources"/>.</param>
 /// <param name="errorHandling">Specifies how errors are handled.</param>
 /// <returns>The key translated to the <see cref="Translator.Culture"/>.</returns>
 public static string?Translate(string key, ErrorHandling errorHandling)
 {
     return(Translator.Translate(ResourceManager, key, errorHandling));
 }
Exemple #7
0
 /// <summary>
 /// Call like this Translator{Properties.Resources}.Translate(nameof(Properties.Resources.SomeKey));.
 /// </summary>
 /// <param name="key">Path to the key. Must be included <typeparamref name="TResources"/>.</param>
 /// <param name="culture">The culture, if null CultureInfo.InvariantCulture is used.</param>
 /// <returns>The key translated to the <paramref name="culture"/>.</returns>
 public static string?Translate(string key, CultureInfo culture)
 {
     return(Translator.Translate(ResourceManager, key, culture, ErrorHandling.Inherit));
 }
Exemple #8
0
 /// <summary>
 /// Translator.Translate(Properties.Resources.ResourceManager, nameof(Properties.Resources.SomeKey));
 /// This assumes that the resource is something like 'Value: {0}' i.e. having one format parameter.
 /// </summary>
 /// <typeparam name="T0">The type of <paramref name="arg0"/> generic to avoid boxing.</typeparam>
 /// <typeparam name="T1">The type of <paramref name="arg1"/> generic to avoid boxing.</typeparam>
 /// <param name="key">The key in <typeparamref name="TResources"/>.</param>
 /// <param name="culture">The culture.</param>
 /// <param name="arg0">The argument will be used as first arguyment in string.Format(culture, format, <paramref name="arg0"/>, <paramref name="arg1"/>).</param>
 /// <param name="arg1">The argument will be used as second argument string.Format(culture, format, <paramref name="arg0"/>, <paramref name="arg1"/>).</param>
 /// <param name="errorHandling">Specifies how to handle errors.</param>
 /// <returns>The key translated to the <paramref name="culture"/>.</returns>
 public static string?Translate <T0, T1>(string key, CultureInfo culture, T0 arg0, T1 arg1, ErrorHandling errorHandling = ErrorHandling.Inherit)
 {
     return(Translator.Translate(ResourceManager, key, culture, arg0, arg1, errorHandling));
 }