turquoiseowl / i18n

Smart internationalization for ASP.NET
Other
556 stars 156 forks source link

Translation text within another translation text #224

Closed kenyeung128 closed 8 years ago

kenyeung128 commented 8 years ago

Hi,

I have the following scenario where y contains another translation text of x, it doesn't seems y get translated correctly.

var x = string.format("{0} which is [[[ good ]]]", "Apple");

var y = string.format("[[[I want {0}]]]", x);

turquoiseowl commented 8 years ago

Correct. Nested nuggets aren't supported at present.

turquoiseowl commented 8 years ago

This may possibly help you here:

var y = string.format("[[[I want {0}]]]", HttpContext.ParseAndTranslate(x));

Ref https://github.com/turquoiseowl/i18n#how-to-get-a-translation-of-a-nugget-in-your-c-code

kenyeung128 commented 8 years ago

great. Using HttpContext.ParseAndTranslate solved my problem. Thanks a lot!