<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Am 22.11.19 um 17:03 schrieb Kai Köhne:<br>
</div>
<blockquote type="cite"
cite="mid:AM0PR02MB4467068220FC98BFD3C80A9A98490@AM0PR02MB4467.eurprd02.prod.outlook.com">
<blockquote type="cite" style="color: #000000;">
<pre class="moz-quote-pre" wrap="">From: Development <a class="moz-txt-link-rfc2396E" href="mailto:development-bounces@qt-project.org" moz-do-not-send="true"><development-bounces@qt-project.org></a> On Behalf Of
Joerg Bornemann
On 11/22/19 7:21 AM, Kai Pastor, DG0YT wrote:
</pre>
<blockquote type="cite" style="color: #000000;">
<pre class="moz-quote-pre" wrap="">Given the Qt Creator example, would it be feasible to make explicit
declaration of a file's context mandatory, at least for the existing
("fast") parser? If not mandatory, an explicit declaration could at
least disable all automatic detection for the rest of the file, making
it possible to use modern C++ without surprises.
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">That's certainly a possibility. With an explicit context declaration (that's easy
to detect) on file level we can use an even simpler parser/extractor that
doesn't have to know much C++ at all.
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">Keep in mind that you need this context available both at runtime and
at lupdate time. That is, the only setup how this IMO would reliably work
is if we make the context a part of the tr() call - effectively calling
QCoreApplication::translate(context, string). This is already possible right
now.
</pre>
</blockquote>
<p>I admit I didn't think about the runtime perspective. But <br>
</p>
<p> QCoreApplication::translate("Context", string)</p>
<p>is much more verbose then</p>
<p> Context::tr(string)</p>
<p>or, with a declared and defined Context for the translation unit,
just</p>
<p> tr(string)</p>
<p>I wonder if an anonymous namespace couldn't be used to safely
implement the latter for the proposed explicit declaration per
translation unit.<br>
</p>
<p>Kai.</p>
</body>
</html>