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

META-INF.resources.js.components.ObjectField.Tabs.BasicInfo.TranslationOptionsContainer.tsx Maven / Gradle / Ivy

The 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 ClayIcon from '@clayui/icon';
import {ClayTooltipProvider} from '@clayui/tooltip';
import {Toggle} from '@liferay/object-js-components-web';
import classNames from 'classnames';
import {
	ILearnResourceContext,
	LearnMessage,
	LearnResourcesContext,
} from 'frontend-js-components-web';
import React from 'react';

import './TranslationOptionsContainer.scss';

interface TranslationOptionsContainerProps {
	learnResources: ILearnResourceContext;
	modelBuilder?: boolean;
	objectDefinition?: ObjectDefinition;
	onSubmit?: () => void;
	published: boolean;
	setValues: (values: Partial) => void;
	values: Partial;
}

export function TranslationOptionsContainer({
	learnResources,
	modelBuilder,
	objectDefinition,
	onSubmit,
	published,
	setValues,
	values,
}: TranslationOptionsContainerProps) {
	const translatableField =
		(values.businessType === 'LongText' ||
			values.businessType === 'RichText' ||
			values.businessType === 'Text' ||
			(Liferay.FeatureFlags['LPD-32050'] &&
				(values.businessType === 'Attachment' ||
					values.businessType === 'Boolean' ||
					values.businessType === 'Date' ||
					values.businessType === 'DateTime' ||
					values.businessType === 'Decimal' ||
					values.businessType === 'Integer' ||
					values.businessType === 'LongInteger' ||
					values.businessType === 'MultiselectPicklist' ||
					values.businessType === 'Picklist' ||
					values.businessType === 'PrecisionDecimal'))) &&
		!values.system;

	return (
		
{!translatableField && ( {`${Liferay.Language.get( 'this-field-type-does-not-support-translations' )} `}   )}
{ event.stopPropagation(); if (onSubmit) { onSubmit(); } }} onToggle={(localized) => setValues({ localized, }) } toggled={values.localized} />
); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy