Adds nicer extensions for the Localize methods to not pass in a Culture and take the Culture from the current thread. Adds GUID Id display to the content/media/members editor

This commit is contained in:
Shannon
2015-05-13 17:33:59 +10:00
parent 416dcdf90f
commit de7294335f
4 changed files with 36 additions and 8 deletions

View File

@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading;
namespace Umbraco.Core.Services
{
@@ -10,6 +11,30 @@ namespace Umbraco.Core.Services
/// </summary>
public static class LocalizedTextServiceExtensions
{
/// <summary>
/// Localize using the current thread culture
/// </summary>
/// <param name="manager"></param>
/// <param name="key"></param>
/// <param name="tokens"></param>
/// <returns></returns>
public static string Localize(this ILocalizedTextService manager, string key, string[] tokens)
{
return manager.Localize(key, Thread.CurrentThread.CurrentUICulture, tokens);
}
/// <summary>
/// Localize using the current thread culture
/// </summary>
/// <param name="manager"></param>
/// <param name="key"></param>
/// <param name="tokens"></param>
/// <returns></returns>
public static string Localize(this ILocalizedTextService manager, string key, IDictionary<string, string> tokens = null)
{
return manager.Localize(key, Thread.CurrentThread.CurrentUICulture, tokens);
}
/// <summary>
/// Localize a key without any variables
/// </summary>