21 #include "with_locale.h"
23 #include "../lib/exception.h"
28 #include <abstractlocalizer.h>
30 WithLocaleNodeFactory::WithLocaleNodeFactory() {}
36 if (expr.size() != 2) {
40 "%1 expected format is for example 'with_locale \"de_DE\"'")
47 auto nodeList = p->
parse(n, QStringLiteral(
"endwith_locale"));
48 n->setNodeList(nodeList);
56 :
Node(parent), m_localeName(localeName)
60 void WithLocaleNode::setNodeList(
const NodeList &nodeList)
Q_INVOKABLE QStringList smartSplit(const QString &str) const
The Context class holds the context to render a Template with.
std::shared_ptr< AbstractLocalizer > localizer() const
An exception for use when implementing template tags.
A FilterExpression object represents a filter expression in a template.
QVariant resolve(OutputStream *stream, Context *c) const
A list of Nodes with some convenience API for rendering them.
void render(OutputStream *stream, Context *c) const
Base class for all nodes.
The OutputStream class is used to render templates to a QTextStream.
The Parser class processes a string template into a tree of nodes.
NodeList parse(Node *parent, const QStringList &stopAt={})
const NestedString & get() const
Node * getNode(const QString &tagContent, Parser *p) const override
void render(OutputStream *stream, Context *c) const override
Cutelee::SafeString getSafeString(const QVariant &input)
Utility functions used throughout Cutelee.