Commit 16a569cd authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Hinweis bei Variablennamen eingefügt

parent a50ff465
...@@ -134,7 +134,7 @@ class LanguageController extends Controller ...@@ -134,7 +134,7 @@ class LanguageController extends Controller
$t = $this->deMultidimensionalizeArray($t); $t = $this->deMultidimensionalizeArray($t);
} }
#die(var_dump($t)); $t = $this->createHints($t, $to);
return view('languages.edit') return view('languages.edit')
->with('texts', $t) ->with('texts', $t)
...@@ -145,9 +145,26 @@ class LanguageController extends Controller ...@@ -145,9 +145,26 @@ class LanguageController extends Controller
->with('langTexts', $langTexts) ->with('langTexts', $langTexts)
->with('sum', $sum) ->with('sum', $sum)
->with('css', 'editLanguage.css') ->with('css', 'editLanguage.css')
->with('js', ['editLanguage.js'])
->with('new', $ex["new"]); ->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 = "") private function getValues($values, $prefix = "")
{ {
$return = []; $return = [];
...@@ -218,13 +235,13 @@ class LanguageController extends Controller ...@@ -218,13 +235,13 @@ class LanguageController extends Controller
return $tmp; return $tmp;
} }
private function startsWith($haystack, $needle) public function startsWith($haystack, $needle)
{ {
// search backwards starting from haystack length characters from the end // search backwards starting from haystack length characters from the end
return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== false; 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 // search forward starting from end minus needle length characters
return $needle === "" || (($temp = strlen($haystack) - strlen($needle)) >= 0 && strpos($haystack, $needle, $temp) !== false); 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 ...@@ -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 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> <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) @foreach($langs as $lang => $value)
<td>{{ $langValues[$lang] or "" }}</td> <td>{!! $langValues[$lang] or "" !!}</td>
@endforeach @endforeach
</tr> </tr>
@endif @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