Skip to content

Commit

Permalink
[TASK] Add localization labels in BE module
Browse files Browse the repository at this point in the history
Resolves: #692
  • Loading branch information
sypets committed Jun 11, 2022
1 parent 014cecf commit c597c01
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 16 deletions.
13 changes: 13 additions & 0 deletions Classes/Controller/BackendController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use HDNET\Calendarize\Register;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Core\Pagination\ArrayPaginator;
use TYPO3\CMS\Core\Pagination\SimplePagination;
use TYPO3\CMS\Extbase\Pagination\QueryResultPaginator;
Expand All @@ -21,6 +22,9 @@
*/
class BackendController extends AbstractController
{
private const PATH_CALENDARIZE_LOCALLANG = 'LLL:EXT:calendarize/Resources/Private/Language/locallang_mod.xlf';
private const PATH_CORE_LOCALLANG = 'LLL:EXT:core/Resources/Private/Language/locallang_common.xlf';

protected $defaultViewObjectName = \TYPO3\CMS\Backend\View\BackendTemplateView::class;

public const OPTIONS_KEY = 'calendarize_be';
Expand Down Expand Up @@ -79,6 +83,10 @@ public function listAction(OptionRequest $options = null, int $currentPage = 1)
'paginator' => $paginator,
'pagination' => $pagination,
'totalAmount' => \count($indices),
'filterOptions' => [
'asc' => $this->getLanguageService()->sL(self::PATH_CORE_LOCALLANG . ':ascending') ?: 'ascending',
'desc' => $this->getLanguageService()->sL(self::PATH_CORE_LOCALLANG . ':descending') ?: 'descending',
],
]);
}

Expand Down Expand Up @@ -231,4 +239,9 @@ protected function getBackendUser(): BackendUserAuthentication
{
return $GLOBALS['BE_USER'];
}

protected function getLanguageService(): ?LanguageService
{
return $GLOBALS['LANG'] ?? null;
}
}
43 changes: 41 additions & 2 deletions Resources/Private/Language/locallang_mod.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,45 @@
<trans-unit id="mlang_labels_tablabel">
<source>Calendarize</source>
</trans-unit>
</body>
</file>
<trans-unit id="on">
<source>on</source>
</trans-unit>
<trans-unit id="note.create_events">
<source>Note: If you create first events in Storage folder, the create buttons will appear in this location</source>
</trans-unit>
<trans-unit id="filter.page">
<source>Page</source>
</trans-unit>
<trans-unit id="filter.type">
<source>Type</source>
</trans-unit>
<trans-unit id="filter.sorting_direction">
<source>Sorting</source>
</trans-unit>
<trans-unit id="filter_save">
<source>Save options</source>
</trans-unit>
<trans-unit id="items_lowercase">
<source>items</source>
</trans-unit>
<trans-unit id="table_header.title">
<source>Title</source>
</trans-unit>
<trans-unit id="table_header.date">
<source>Date</source>
</trans-unit>
<trans-unit id="table_header.type">
<source>Type</source>
</trans-unit>
<trans-unit id="table_header.language">
<source>Language</source>
</trans-unit>
<trans-unit id="table_header.id">
<source>ID</source>
</trans-unit>
<trans-unit id="table_header.action">
<source>Action</source>
</trans-unit>
</body>
</file>
</xliff>
14 changes: 9 additions & 5 deletions Resources/Private/Partials/Backend/Filter.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
</f:comment>

<div class="form-group col">
<label class="form-label" for="pid">PID</label>
<label class="form-label" for="pid">
<f:translate key="LLL:EXT:calendarize/Resources/Private/Language/locallang_mod.xlf:filter.page">Page</f:translate>
</label>
<f:form.select
prependOptionLabel="All"
prependOptionValue="-1"
Expand All @@ -31,7 +33,9 @@
</div>

<div class="form-group col">
<label class="form-label" for="type">Type</label>
<label class="form-label" for="type">
<f:translate key="LLL:EXT:calendarize/Resources/Private/Language/locallang_mod.xlf:filter.type">Type</f:translate>
</label>
<f:form.select
prependOptionLabel="All"
prependOptionValue=""
Expand All @@ -43,9 +47,9 @@
</div>

<div class="form-group col">
<label class="form-label" for="direction">Direction</label>
<label class="form-label" for="direction"><f:translate key="LLL:EXT:calendarize/Resources/Private/Language/locallang_mod.xlf:filter.sorting_direction">Sorting</f:translate></label>
<f:form.select
options="{asc: 'ASC', desc: 'DESC'}"
options="{filterOptions}"
class="form-control form-select"
id="direction"
property="direction"
Expand Down Expand Up @@ -83,7 +87,7 @@
</div>

<div class="col form-group">
<f:form.submit value="Save options" class="btn btn-light"/>
<f:form.submit value="{f:translate(key: 'LLL:EXT:calendarize/Resources/Private/Language/locallang_mod.xlf:filter_save')}" class="btn btn-light"/>
</div>
</div>
</f:form>
Expand Down
14 changes: 7 additions & 7 deletions Resources/Private/Partials/Backend/List.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@
<thead>
<tr>
<th class="col-title">
Title
<f:translate key="LLL:EXT:calendarize/Resources/Private/Language/locallang_mod.xlf:table_header.title">Title</f:translate>
</th>
<th class="col-title">
Date
<f:translate key="LLL:EXT:calendarize/Resources/Private/Language/locallang_mod.xlf:table_header.date">Date</f:translate>
</th>
<th class="col-title">
Type
<f:translate key="LLL:EXT:calendarize/Resources/Private/Language/locallang_mod.xlf:table_header.type">Type</f:translate>
</th>
<th class="col-title">
Language
<f:translate key="LLL:EXT:calendarize/Resources/Private/Language/locallang_mod.xlf:table_header.language">Language</f:translate>
</th>
<th class="col-title">
ID
<f:translate key="LLL:EXT:calendarize/Resources/Private/Language/locallang_mod.xlf:table_header.id">ID</f:translate>
</th>
<th class="col-title">
Action
<f:translate key="LLL:EXT:calendarize/Resources/Private/Language/locallang_mod.xlf:table_header.action">Action</f:translate>
</th>
</tr>
</thead>
Expand All @@ -33,7 +33,7 @@
<tr>
<td colspan="6">
{totalAmount}
items
<f:translate key="LLL:EXT:calendarize/Resources/Private/Language/locallang_mod.xlf:items_lowercase">items</f:translate>
</td>
</tr>
</tfoot>
Expand Down
8 changes: 6 additions & 2 deletions Resources/Private/Templates/Backend/List.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,19 @@ <h1>Calendarize</h1>
<be:link.newRecord class="btn btn-primary" table="{table}" pid="{pid}" style="margin-bottom:4px"
returnUrl="{f:be.uri(route: 'web_CalendarizeCalendarize')}">
<core:icon identifier="actions-document-new"/>
{value} on {pids.{pid}}
{value} <f:translate key="LLL:EXT:calendarize/Resources/Private/Language/locallang_mod.xlf:on">on</f:translate> {pids.{pid}}
</be:link.newRecord>
</f:if>
</f:for>
</f:for>
</p>
</f:then>
<f:else>
<p>Note: If you create first events in Storage folder, the create buttons will appear in this location</p>
<p>
<f:translate key="LLL:EXT:calendarize/Resources/Private/Language/locallang_mod.xlf:note.create_events">
Note: If you create first events in Storage folder, the create buttons will appear in this location
</f:translate>
</p>
</f:else>
</f:if>
</fieldset>
Expand Down

0 comments on commit c597c01

Please sign in to comment.