Issue 9743: Added translatable texts

This commit is contained in:
Michael 2021-03-08 21:17:27 +00:00
parent f6873cc912
commit 972c9f7bc0
10 changed files with 148 additions and 124 deletions

View File

@ -54,11 +54,23 @@ class Source extends BaseAdmin
$tpl = Renderer::getMarkupTemplate('admin/item/source.tpl'); $tpl = Renderer::getMarkupTemplate('admin/item/source.tpl');
$o = Renderer::replaceMacros($tpl, [ $o = Renderer::replaceMacros($tpl, [
'$guid' => ['guid', DI::l10n()->t('Item Guid'), $guid, ''], '$title' => DI::l10n()->t('Item Source'),
'$source' => $source, '$guid' => ['guid', DI::l10n()->t('Item Guid'), $guid, ''],
'$item_uri' => $item_uri, '$source' => $source,
'$item_id' => $item_id, '$item_uri' => $item_uri,
'$terms' => $terms, '$item_id' => $item_id,
'$terms' => $terms,
'$itemidlbl' => DI::l10n()->t('Item Id'),
'$itemurilbl' => DI::l10n()->t('Item URI'),
'$submit' => DI::l10n()->t('Submit'),
'$termslbl' => DI::l10n()->t('Terms'),
'$taglbl' => DI::l10n()->t('Tag'),
'$typelbl' => DI::l10n()->t('Type'),
'$termlbl' => DI::l10n()->t('Term'),
'$urllbl' => DI::l10n()->t('URL'),
'$mentionlbl' => DI::l10n()->t('Mention'),
'$implicitlbl' => DI::l10n()->t('Implicit Mention'),
'$sourcelbl' => DI::l10n()->t('Source'),
]); ]);
return $o; return $o;

View File

@ -135,8 +135,10 @@ class ActivityPubConversion extends BaseModule
$tpl = Renderer::getMarkupTemplate('debug/activitypubconversion.tpl'); $tpl = Renderer::getMarkupTemplate('debug/activitypubconversion.tpl');
$o = Renderer::replaceMacros($tpl, [ $o = Renderer::replaceMacros($tpl, [
'$source' => ['source', DI::l10n()->t('Source activity'), $_REQUEST['source'] ?? '', ''], '$title' => DI::l10n()->t('ActivityPub Conversion'),
'$results' => $results '$source' => ['source', DI::l10n()->t('Source activity'), $_REQUEST['source'] ?? '', ''],
'$results' => $results,
'$submit' => DI::l10n()->t('Submit'),
]); ]);
return $o; return $o;

View File

@ -24,13 +24,10 @@ namespace Friendica\Module\Debug;
use Friendica\BaseModule; use Friendica\BaseModule;
use Friendica\Content\PageInfo; use Friendica\Content\PageInfo;
use Friendica\Content\Text; use Friendica\Content\Text;
use Friendica\Core\Protocol;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Conversation;
use Friendica\Model\Item; use Friendica\Model\Item;
use Friendica\Protocol\Activity; use Friendica\Protocol\Activity;
use Friendica\Model\Tag;
use Friendica\Util\XML; use Friendica\Util\XML;
/** /**
@ -306,6 +303,7 @@ class Babel extends BaseModule
$tpl = Renderer::getMarkupTemplate('babel.tpl'); $tpl = Renderer::getMarkupTemplate('babel.tpl');
$o = Renderer::replaceMacros($tpl, [ $o = Renderer::replaceMacros($tpl, [
'$title' => DI::l10n()->t('Babel Diagnostic'),
'$text' => ['text', DI::l10n()->t('Source text'), $_REQUEST['text'] ?? '', ''], '$text' => ['text', DI::l10n()->t('Source text'), $_REQUEST['text'] ?? '', ''],
'$type_bbcode' => ['type', DI::l10n()->t('BBCode'), 'bbcode', '', (($_REQUEST['type'] ?? '') ?: 'bbcode') == 'bbcode'], '$type_bbcode' => ['type', DI::l10n()->t('BBCode'), 'bbcode', '', (($_REQUEST['type'] ?? '') ?: 'bbcode') == 'bbcode'],
'$type_diaspora' => ['type', DI::l10n()->t('Diaspora'), 'diaspora', '', (($_REQUEST['type'] ?? '') ?: 'bbcode') == 'diaspora'], '$type_diaspora' => ['type', DI::l10n()->t('Diaspora'), 'diaspora', '', (($_REQUEST['type'] ?? '') ?: 'bbcode') == 'diaspora'],
@ -313,7 +311,8 @@ class Babel extends BaseModule
'$type_html' => ['type', DI::l10n()->t('HTML'), 'html', '', (($_REQUEST['type'] ?? '') ?: 'bbcode') == 'html'], '$type_html' => ['type', DI::l10n()->t('HTML'), 'html', '', (($_REQUEST['type'] ?? '') ?: 'bbcode') == 'html'],
'$flag_twitter' => file_exists('addon/twitter/twitter.php'), '$flag_twitter' => file_exists('addon/twitter/twitter.php'),
'$type_twitter' => ['type', DI::l10n()->t('Twitter Source / Tweet URL (requires API key)'), 'twitter', '', (($_REQUEST['type'] ?? '') ?: 'bbcode') == 'twitter'], '$type_twitter' => ['type', DI::l10n()->t('Twitter Source / Tweet URL (requires API key)'), 'twitter', '', (($_REQUEST['type'] ?? '') ?: 'bbcode') == 'twitter'],
'$results' => $results '$results' => $results,
'$submit' => DI::l10n()->t('Submit'),
]); ]);
return $o; return $o;

View File

@ -50,13 +50,16 @@ class Probe extends BaseModule
$tpl = Renderer::getMarkupTemplate('probe.tpl'); $tpl = Renderer::getMarkupTemplate('probe.tpl');
return Renderer::replaceMacros($tpl, [ return Renderer::replaceMacros($tpl, [
'$addr' => ['addr', '$title' => DI::l10n()->t('Probe Diagnostic'),
'$output' => DI::l10n()->t('Output'),
'$submit' => DI::l10n()->t('Submit'),
'$addr' => ['addr',
DI::l10n()->t('Lookup address'), DI::l10n()->t('Lookup address'),
$addr, $addr,
'', '',
DI::l10n()->t('Required') DI::l10n()->t('Required')
], ],
'$res' => $res, '$res' => $res,
]); ]);
} }
} }

View File

@ -49,8 +49,11 @@ class WebFinger extends BaseModule
$tpl = Renderer::getMarkupTemplate('webfinger.tpl'); $tpl = Renderer::getMarkupTemplate('webfinger.tpl');
return Renderer::replaceMacros($tpl, [ return Renderer::replaceMacros($tpl, [
'$addr' => $addr, '$title' => DI::l10n()->t('Webfinger Diagnostic'),
'$res' => $res, '$submit' => DI::l10n()->t('Submit'),
'$lookup' => DI::l10n()->t('Lookup address:'),
'$addr' => $addr,
'$res' => $res,
]); ]);
} }
} }

View File

@ -1,65 +1,67 @@
<h2>Item Source</h2> <div id="source" class="generic-page-wrapper">
<form action="admin/item/source" method="get" class="panel panel-default"> <h2>{{$title}}</h2>
<div class="panel-body"> <form action="admin/item/source" method="get" class="panel panel-default">
<div class="form-group"> <div class="panel-body">
{{include file="field_input.tpl" field=$guid}} <div class="form-group">
{{include file="field_input.tpl" field=$guid}}
</div>
<p><button type="submit" class="btn btn-primary">{{$submit}}</button></p>
</div> </div>
<p><button type="submit" class="btn btn-primary">Submit</button></p> </form>
</div>
</form>
{{if $source}} {{if $source}}
<div class="itemsource-results"> <div class="itemsource-results">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h3 class="panel-title">Item Id</h3> <h3 class="panel-title">{{$itemidlbl}}</h3>
</div>
<div class="panel-body">
{{$item_id}}
</div>
</div> </div>
<div class="panel-body"> <div class="panel panel-default">
{{$item_id}} <div class="panel-heading">
<h3 class="panel-title">{{$itemurilbl}}</h3>
</div>
<div class="panel-body">
{{$item_uri}}
</div>
</div> </div>
</div> <div class="panel panel-default">
<div class="panel panel-default"> <div class="panel-heading">
<div class="panel-heading"> <h3 class="panel-title">{{$termslbl}}</h3>
<h3 class="panel-title">Item URI</h3> </div>
<div class="panel-body">
<table class="table table-condensed table-striped">
<tr>
<th>{{$typelbl}}</th>
<th>{{$termlbl}}</th>
<th>{{$urllbl}}</th>
</tr>
{{foreach $terms as $term}}
<tr>
<td>
{{if $term.type == 1}}{{$tag}}{{/if}}
{{if $term.type == 2}}{{$mentionlbl}}{{/if}}
{{if $term.type == 8}}{{$implicitlbl}}{{/if}}
</td>
<td>
{{$term.name}}
</td>
<td>
{{$term.url}}
</td>
</tr>
{{/foreach}}
</table>
</div>
</div> </div>
<div class="panel-body"> <div class="panel panel-default">
{{$item_uri}} <div class="panel-heading">
<h3 class="panel-title">{{$sourcelbl}}</h3>
</div>
<pre><code class="language-php">{{$source}}</code></pre>
</div> </div>
</div> </div>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Terms</h3>
</div>
<div class="panel-body">
<table class="table table-condensed table-striped">
<tr>
<th>Type</th>
<th>Term</th>
<th>URL</th>
</tr>
{{foreach $terms as $term}}
<tr>
<td>
{{if $term.type == 1}}Tag{{/if}}
{{if $term.type == 2}}Mention{{/if}}
{{if $term.type == 8}}Implicit Mention{{/if}}
</td>
<td>
{{$term.name}}
</td>
<td>
{{$term.url}}
</td>
</tr>
{{/foreach}}
</table>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Source</h3>
</div>
<pre><code class="language-php">{{$source}}</code></pre>
</div>
</div> </div>
{{/if}} {{/if}}

View File

@ -1,31 +1,33 @@
<h2>Babel Diagnostic</h2> <div id="babel" class="generic-page-wrapper">
<form action="babel" method="post" class="panel panel-default"> <h2>{{$title}}</h2>
<div class="panel-body"> <form action="babel" method="post" class="panel panel-default">
<div class="form-group"> <div class="panel-body">
{{include file="field_textarea.tpl" field=$text}} <div class="form-group">
{{include file="field_textarea.tpl" field=$text}}
</div>
<div class="form-group">
{{include file="field_radio.tpl" field=$type_bbcode}}
{{include file="field_radio.tpl" field=$type_diaspora}}
{{include file="field_radio.tpl" field=$type_markdown}}
{{include file="field_radio.tpl" field=$type_html}}
{{if $flag_twitter}}
{{include file="field_radio.tpl" field=$type_twitter}}
{{/if}}
</div>
<p><button type="submit" class="btn btn-primary">{{$submit}}</button></p>
</div> </div>
<div class="form-group"> </form>
{{include file="field_radio.tpl" field=$type_bbcode}}
{{include file="field_radio.tpl" field=$type_diaspora}}
{{include file="field_radio.tpl" field=$type_markdown}}
{{include file="field_radio.tpl" field=$type_html}}
{{if $flag_twitter}}
{{include file="field_radio.tpl" field=$type_twitter}}
{{/if}}
</div>
<p><button type="submit" class="btn btn-primary">Submit</button></p>
</div>
</form>
{{if $results}} {{if $results}}
<div class="babel-results"> <div class="babel-results">
{{foreach $results as $result}} {{foreach $results as $result}}
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h3 class="panel-title">{{$result.title}}</h3> <h3 class="panel-title">{{$result.title}}</h3>
</div>
<div class="panel-body">{{$result.content nofilter}}</div>
</div> </div>
<div class="panel-body">{{$result.content nofilter}}</div> {{/foreach}}
</div> </div>
{{/foreach}}
</div> </div>
{{/if}} {{/if}}

View File

@ -1,24 +1,26 @@
<h2>ActivityPub Conversion</h2> <div id="apconversion" class="generic-page-wrapper">
<form action="debug/ap" method="post" class="panel panel-default"> <h2>{{$title}}</h2>
<div class="panel-body"> <form action="debug/ap" method="post" class="panel panel-default">
<div class="form-group">
{{include file="field_textarea.tpl" field=$source}}
</div>
<p><button type="submit" class="btn btn-primary">Submit</button></p>
</div>
</form>
{{if $results}}
<div class="babel-results">
{{foreach $results as $result}}
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{{$result.title}}</h3>
</div>
<div class="panel-body"> <div class="panel-body">
{{$result.content nofilter}} <div class="form-group">
{{include file="field_textarea.tpl" field=$source}}
</div>
<p><button type="submit" class="btn btn-primary">{{$submit}}</button></p>
</div> </div>
</form>
{{if $results}}
<div class="babel-results">
{{foreach $results as $result}}
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{{$result.title}}</h3>
</div>
<div class="panel-body">
{{$result.content nofilter}}
</div>
</div>
{{/foreach}}
</div> </div>
{{/foreach}} {{/if}}
</div> </div>
{{/if}}

View File

@ -1,11 +1,11 @@
<div id="probe" class="generic-page-wrapper"> <div id="probe" class="generic-page-wrapper">
<h2>Probe Diagnostic</h2> <h2>{{$title}}</h2>
<form action="probe" method="get" class="panel panel-default"> <form action="probe" method="get" class="panel panel-default">
<div class="panel-body"> <div class="panel-body">
<div class="form-group"> <div class="form-group">
{{include file="field_input.tpl" field=$addr}} {{include file="field_input.tpl" field=$addr}}
</div> </div>
<p><button type="submit" class="btn btn-primary">Submit</button></p> <p><button type="submit" class="btn btn-primary">{{$submit}}</button></p>
</div> </div>
</form> </form>
@ -13,7 +13,7 @@
<div class="probe-result"> <div class="probe-result">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h3 class="panel-title">Output</h3> <h3 class="panel-title">{{$output}}</h3>
</div> </div>
<div class="panel-body"> <div class="panel-body">
<pre>{{$res}}</pre> <pre>{{$res}}</pre>

View File

@ -1,9 +1,8 @@
<div class="generic-page-wrapper"> <div class="generic-page-wrapper">
<h3>Webfinger Diagnostic</h3> <h2>{{$title}}</h2>
<form action="webfinger" method="get"> <form action="webfinger" method="get">
Lookup address: <input type="text" style="width: 250px;" name="addr" value="{{$addr}}" /> {{$lookup}} <input type="text" style="width: 250px;" name="addr" value="{{$addr}}" />
<input type="submit" name="submit" value="Submit" /> <input type="submit" name="submit" value="{{$submit}}" />
</form> </form>
<br /><br /> <br /><br />