import React from 'react'; import {appConfig} from 'appConfig'; import {ILanguage} from 'superdesk-interfaces/Language'; import {gettext} from 'core/utils'; import {IVocabularyItem} from 'superdesk-api'; interface IProps { item: IVocabularyItem; update(field: T, value: IVocabularyItem[T]): void; languages: Array; } export class ManageVocabularyItemTranslations extends React.PureComponent { render() { const {languages, item, update} = this.props; return (
{ languages .filter((language) => appConfig.default_language !== language.language) .map((language) => (
{ const {value} = event.target; const allTranslations = item.translations ?? {}; const nameTranslations = allTranslations.name ?? {}; const nameTranslationsUpdated = { ...nameTranslations, [language.language]: value, }; update( 'translations', { ...allTranslations, name: nameTranslationsUpdated, }, ); }} className="sd-line-input__input" />
)) }
); } }