<%--
/**
 * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
 *
 * The contents of this file are subject to the terms of the Liferay Enterprise
 * Subscription License ("License"). You may not use this file except in
 * compliance with the License. You can obtain a copy of the License by
 * contacting Liferay, Inc. See the License for the specific language governing
 * permissions and limitations under the License, including but not limited to
 * distribution rights of the Software.
 *
 *
 *
 */
--%>

<%@ include file="/init.jsp" %>

<%
String backURL = ParamUtil.getString(request, "backURL", String.valueOf(renderResponse.createRenderURL()));

String redirect = ParamUtil.getString(request, "redirect", backURL);

portletDisplay.setShowBackIcon(true);
portletDisplay.setURLBack(backURL);

renderResponse.setTitle(LanguageUtil.get(request, "import-translations"));
%>

<portlet:actionURL name="/portal_language_override/import_translations" var="importTranslationsURL">
	<portlet:param name="redirect" value="<%= redirect %>" />
</portlet:actionURL>

<clay:container-fluid
	cssClass="container-view"
>
	<aui:form action="<%= importTranslationsURL %>" cssClass="sheet sheet-lg" enctype="multipart/form-data" method="post" name="fm">
		<liferay-ui:error key="fileExtensionInvalid" message='<%= LanguageUtil.format(request, "please-upload-a-file-with-a-valid-extension-x", "properties", false) %>' />
		<liferay-ui:error key="fileInvalid" message="please-select-a-valid-file" />

		<h5><liferay-ui:message key="import-file" /></h5>

		<div class="sheet-text">
			<liferay-ui:message arguments=".properties" key="support-file-format" />
		</div>

		<aui:select label="language" name="languageId">

			<%
			Set<Locale> locales = LanguageUtil.getCompanyAvailableLocales(themeDisplay.getCompanyId());

			for (Locale curLocale : locales) {
				String languageId = LanguageUtil.getLanguageId(curLocale);
			%>

				<aui:option label="<%= TextFormatter.format(languageId, TextFormatter.O) %>" value="<%= languageId %>" />

			<%
			}
			%>

		</aui:select>

		<aui:input id="file" label="file-upload" name="file" type="file">
			<aui:validator name="required" />

			<aui:validator name="acceptFiles">
				'properties'
			</aui:validator>
		</aui:input>

		<aui:button-row>
			<aui:button name="submit" type="submit" />

			<aui:button href="<%= redirect %>" type="cancel" />
		</aui:button-row>
	</aui:form>
</clay:container-fluid>