November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
Hi,
Looking at the Translate methods in EPiServer.Core.LanguageManager, you can see that the "[Missing text ...]" string is hardcoded as a return value if a text hasn't been translated:
public string Translate(string key, string language)
{
string str = this.TranslateRaw(key, language);
if (str == null)
{
return ("[Missing text " + key + " for " + language + "]");
}
return str;
}
So what you could do is create your own Translate method that calls LanguageManager.Instance.Translate (and the overload methods if you're using those), and checks if the return value contains "[Missing text...]". If so, log the non translated text:
public static class MyLanguageManager
{
public static string Translate(string key)
{
string translatedText = LanguageManager.Instance.Translate(key);
if (!string.IsNullOrEmpty(translatedText) && translatedText.StartsWith("[Missing text ")) // Or you can use Regex
Logger.Debug(translatedText);
return translatedText;
}
}
Now, instead of calling LanguageManager.Instance.Translate(...) or BasePage.Translate(...) elsewhere in your code, you call MyLanguageManager.Translate(...) instead.
I hope this helps!
Karoline
Is there any way to log non translated texts in EPiServer?
/Jonas