<xf:title>{$language.title} - {{ phrase('phrases') }}</xf:title>

<xf:page option="breadcrumbPath" value="languages" />
<xf:page option="section" value="phrases" />

<xf:pageaction>
	<xf:button href="{{ link('phrases/add', null, {'language_id': $language.language_id}) }}" icon="add"
		data-xf-click="prefix-grabber"
		data-filter-element="[data-xf-init~=filter]">
		{{ phrase('add_phrase') }}
	</xf:button>
</xf:pageaction>

<div class="block">
	<div class="block-outer">
		<div class="block-outer-main">
			<xf:macro id="language_macros::language_change_menu"
				arg-languageTree="{$languageTree}"
				arg-currentLanguage="{$language}"
				arg-route="languages/phrases"
				arg-routeParams="{$linkParams}" />

			<xf:macro id="addon_macros::addon_change_menu"
				arg-addOns="{$addOns}"
				arg-currentAddOn="{$currentAddOn}"
				arg-route="languages/phrases"
				arg-routeData="{$language}"
				arg-routeParams="{$linkParams}" />
		</div>
		<xf:macro id="filter_macros::quick_filter"
			arg-key="phrases"
			arg-ajax="{{ link('languages/phrases', $language, $linkParams) }}"
			arg-class="block-outer-opposite" />
	</div>
	<div class="block-container">
		<xf:macro id="filter_macros::filter_bar"
			arg-params="{{ {'language_id': $language.language_id, 'addon_id': $currentAddOn ? $currentAddOn.addon_id : null} }}"
			arg-menu="phrases/refine-search"
			arg-menuTitle="{{ phrase('refine_and_translate') }}" />

		<div class="block-body">
			<xf:datalist>
				<xf:macro id="phrase_list" arg-phrases="{$phrases}" arg-language="{$language}" arg-page="{$page}" />
				<xf:if is="$filter AND $total > $perPage">
					<xf:datarow rowclass="dataList-row--note dataList-row--noHover js-filterForceShow">
						<xf:cell colspan="2">{{ phrase('more_records_matching_filter_more_specific') }}</xf:cell>
					</xf:datarow>
				</xf:if>
			</xf:datalist>
		</div>

		<div class="block-footer">
			<span class="block-footer-counter">{{ display_totals($phrases, $total) }}</span>
		</div>
	</div>

	<xf:pagenav
		page="{$page}" perpage="{$perPage}" total="{$total}"
		link="languages/phrases"
		params="{$linkParams}"
		data="{$language}"
		wrapperclass="js-filterHide block-outer block-outer--after" />
</div>

<xf:macro id="phrase_list" arg-phrases="!" arg-language="!" arg-page="">
	<xf:foreach loop="$phrases" value="$phrase">
		<xf:datarow rowclass="{{ ($phrase.language_id == 0 ? '' : ($phrase.language_id == $language.language_id ? 'dataList-row--custom' : 'dataList-row--parentCustom')) }}">
			<xf:main href="{{ link('phrases/edit', $phrase, {'language_id': $language.language_id}) }}"
				label="{$phrase.title}"
				hint="{{ ($phrase.addon_id && $phrase.addon_id != 'XF' && $phrase.AddOn) ? $phrase.AddOn.title : '' }}"
				colspan="{{ $phrase.language_id == $language.language_id ? 1 : 2 }}"
				hash="{$phrase.phrase_id}"
				dir="auto" />
			<xf:if is="$phrase.language_id == $language.language_id">
				<xf:delete href="{{ link('phrases/delete', $phrase) }}" tooltip="{{ $phrase.language_id ? phrase('revert') : phrase('delete') }}" />
			</xf:if>
		</xf:datarow>
	</xf:foreach>
</xf:macro>