diff --git a/source/vibe/templ/diet.d b/source/vibe/templ/diet.d index 77aab249a5..8921f53604 100644 --- a/source/vibe/templ/diet.d +++ b/source/vibe/templ/diet.d @@ -362,6 +362,7 @@ private class OutputContext { Line m_line = Line(null, -1, null); size_t m_baseIndent; bool m_isHTML5; + bool warnTranslationContext = false; this(size_t base_indent = 0) { @@ -488,6 +489,8 @@ private struct DietCompiler(TRANSLATE...) auto output = new OutputContext(base_indent); buildWriter(output, 0); assert(output.m_nodeStack.length == 0, "Template writer did not consume all nodes!?"); + if (output.warnTranslationContext) + output.writeCodeLine(`pragma(msg, "Warning: No translation context found, ignoring '&' suffixes. Note that you have to use @translationContext in conjunction with vibe.web.web.render() (vibe.http.server.render() does not work) to enable translation support.");`); return output.m_result; } @@ -854,7 +857,9 @@ private struct DietCompiler(TRANSLATE...) output.writeExpr(ctstrip(line[i+2 .. line.length])); } else { string rawtext = line[i .. line.length]; - static if (TRANSLATE.length > 0) if (ws_type.isTranslated) rawtext = TRANSLATE[0](rawtext); + static if (TRANSLATE.length > 0) { + if (ws_type.isTranslated) rawtext = TRANSLATE[0](rawtext); + } else if (ws_type.isTranslated) output.warnTranslationContext = true; if (hasInterpolations(rawtext)) { buildInterpolatedString(output, rawtext); } else {