Commit 2687da8c authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Hinweis bei Variablennamen eingefügt

parent b2a6083b
......@@ -134,7 +134,7 @@ class LanguageController extends Controller
$t = $this->deMultidimensionalizeArray($t);
}
#die(var_dump($t));
$t = $this->createHints($t, $to);
return view('languages.edit')
->with('texts', $t)
......@@ -145,9 +145,26 @@ class LanguageController extends Controller
->with('langTexts', $langTexts)
->with('sum', $sum)
->with('css', 'editLanguage.css')
->with('js', ['editLanguage.js'])
->with('new', $ex["new"]);
}
private function createHints($t, $to)
{
foreach ($t as $key => $langTexts) {
foreach ($langTexts as $lang => $text) {
if ($lang !== $to) {
if (preg_match("/\s:\S+/si", $text)) {
#die("test");
$t[$key][$lang] = preg_replace("/(\s)(:\S+)/si", "$1<a class=\"text-danger hint\" data-toggle=\"tooltip\" data-trigger=\"hover\" data-placement=\"auto\" title=\"Dies ist ein Variablenname. Er wird dort, wo der Text verwendet wird durch einen dynamischen Wert ersetzt. In der Übersetzung sollte dieser deshalb auch so wie er ist in den Satz integriert werden.\" data-container=\"body\" >$2</a>", $text);
}
}
}
}
return $t;
}
private function getValues($values, $prefix = "")
{
$return = [];
......@@ -218,13 +235,13 @@ class LanguageController extends Controller
return $tmp;
}
private function startsWith($haystack, $needle)
public function startsWith($haystack, $needle)
{
// search backwards starting from haystack length characters from the end
return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== false;
}
private function endsWith($haystack, $needle)
public function endsWith($haystack, $needle)
{
// search forward starting from end minus needle length characters
return $needle === "" || (($temp = strlen($haystack) - strlen($needle)) >= 0 && strpos($haystack, $needle, $temp) !== false);
......
$(document).ready(function() {
$(".hint").tooltip();
});
\ No newline at end of file
......@@ -39,7 +39,7 @@ In der nächsten Spalte findest du entweder Texte der Sprache für die uns einig
<td class="name">{{preg_replace("/(\s*).*#(.*)$/si", "$1$2", $name)}}</td>
<td>@if(isset($langValues[$to])) <input type="text" size="50" form="submit" name="_new_{{$name}}" value="{{$langValues[$to]}}" readonly /> @else <input type="text" size="50" form="submit" name="_new_{{$name}}" /> @endif</td>
@foreach($langs as $lang => $value)
<td>{{ $langValues[$lang] or "" }}</td>
<td>{!! $langValues[$lang] or "" !!}</td>
@endforeach
</tr>
@endif
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment