All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.js.ChangeDefaultLanguage.es.js Maven / Gradle / Ivy

There is a newer version: 5.0.181
Show newest version
/**
 * SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
 * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
 */

import ClayAlert from '@clayui/alert';
import ClayButton from '@clayui/button';
import ClayDropDown from '@clayui/drop-down';
import ClayIcon from '@clayui/icon';
import ClayLabel from '@clayui/label';
import ClayLayout from '@clayui/layout';
import PropTypes from 'prop-types';
import React, {useCallback, useState} from 'react';

function ChangeDefaultLanguage(props) {
	const [active, setActive] = useState(false);

	const [selectedDefaultLanguage, setSelectedDefaultLanguage] = useState(
		props.defaultLanguage
	);

	const onItemClick = useCallback((event, language) => {
		setSelectedDefaultLanguage(language);
		setActive(false);

		Liferay.fire('inputLocalized:defaultLocaleChanged', {
			item: event.currentTarget,
		});
	}, []);

	return (
		

{`${Liferay.Language.get( 'web-content-default-language' )}: `} {props.strings[selectedDefaultLanguage]}

{Liferay.FeatureFlags['LPD-11228'] && ( {Liferay.Language.get( "changing-the-default-language-will-reset-the-article's-history-making-previous-changes-untrackable" )} )} {Liferay.Language.get('change')} } > {props.languages.map((item) => ( onItemClick(event, item.label)} title={item.label} > {item.label} {item.label === selectedDefaultLanguage && ( {Liferay.Language.get('default')} )} ))}
); } ChangeDefaultLanguage.propTypes = { languages: PropTypes.arrayOf( PropTypes.shape({ icon: PropTypes.string, label: PropTypes.string, }) ).isRequired, strings: PropTypes.object.isRequired, }; export default ChangeDefaultLanguage;




© 2015 - 2024 Weber Informatics LLC | Privacy Policy