Translate basic HTML views

app('view') call to set translator is temporary. See #189
This commit is contained in:
Toby Zerner 2015-10-21 11:36:49 +10:30
parent 882133ca55
commit 69f8acd0e0
4 changed files with 9 additions and 7 deletions

View File

@ -164,6 +164,8 @@ abstract class AbstractClientController extends AbstractHtmlController
$localeCompiler->setTranslations($translations);
}
app('view')->share('translator', $this->locales->getTranslator());
return $view;
}

View File

@ -2,9 +2,9 @@
<div class="Alert">
<div class="container">
@if ($noJs)
Something went wrong while trying to load the full version of this site.
{{ $translator->trans('core.basic.load_error_message') }}
@else
This site is best viewed in a modern browser with JavaScript enabled.
{{ $translator->trans('core.basic.javascript_disabled_message') }}
@endif
</div>
</div>

View File

@ -9,7 +9,7 @@ $postsCount = count($discussion->relationships->posts->data);
@foreach ($posts as $post)
<div>
<?php $user = $getResource($post->relationships->user->data); ?>
<h3>{{ $user ? $user->attributes->username : '[deleted]' }}</h3>
<h3>{{ $user ? $user->attributes->username : $translator->trans('core.lib.deleted_user_text') }}</h3>
<div class="Post-body">
{!! $post->attributes->contentHtml !!}
</div>
@ -20,10 +20,10 @@ $postsCount = count($discussion->relationships->posts->data);
</div>
@if ($page > 1)
<a href="{{ $url(['page' => $page - 1]) }}">&laquo; Previous Page</a>
<a href="{{ $url(['page' => $page - 1]) }}">&laquo; {{ $translator->trans('core.basic.previous_page_button') }}</a>
@endif
@if ($page < $postsCount / 20)
<a href="{{ $url(['page' => $page + 1]) }}">Next Page &raquo;</a>
<a href="{{ $url(['page' => $page + 1]) }}">{{ $translator->trans('core.basic.next_page_button') }} &raquo;</a>
@endif
</div>

View File

@ -2,7 +2,7 @@
$url = app('Flarum\Forum\UrlGenerator');
?>
<div class="container">
<h2>All Discussions</h2>
<h2>{{ $translator->trans('core.ref.all_discussions') }}</h2>
<ul>
@foreach ($document->data as $discussion)
@ -16,5 +16,5 @@ $url = app('Flarum\Forum\UrlGenerator');
@endforeach
</ul>
<a href="{{ $url->toRoute('index') }}?page={{ $page + 1 }}">Next Page &raquo;</a>
<a href="{{ $url->toRoute('index') }}?page={{ $page + 1 }}">{{ $translator->trans('core.basic.next_page_button') }} &raquo;</a>
</div>