Is there a token for translating the result of another token to current culture?

Topics: Localization
Jul 14, 2015 at 5:59 AM
Is there a token for translating the result of another token to current culture?
Jul 14, 2015 at 9:11 AM
I haven't found one but it is so easy to create one yourself ... ;)
public class TextTokens : ITokenProvider
    {
        public TextTokens()
        {
            T = NullLocalizer.Instance;
        }

        public Localizer T { get; set; }

        public void Describe(DescribeContext context)
        {
            context.For("Text", T("Text"), T("Tokens for text strings"))
                .Token("Translate", T("Translate Text"), T("Translates to current culture."), "Text");
        }

        public void Evaluate(EvaluateContext context)
        {
            context.For<String>("Text", () => "")
                .Token("Translate", text => T(text));
        }
    }