Skip to content

Commit

Permalink
UIOR-1018 Provide local translations to ControlledVocab (#1422)
Browse files Browse the repository at this point in the history
* Add translations for acq methods controlled vocab

* Add translations for closing reasons controlled vocab

* Add translations for prefixes controlled vocab

* UIOR-1018 Add translations for suffixes controlled vocab

* UIOR-1018 use common util to get translations

* update changelog

* Preserve used translation key

* bump up stripes-acq-components version
  • Loading branch information
usavkov-epam authored Nov 9, 2022
1 parent e4853dc commit 6a9dea3
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## (IN PROGRESS)

* Use Orders Export History API (mod-orders). Refs UIOR-1034.
* Provide local translations to `ControlledVocab`. Refs UIOR-1018.

## [3.3.0](https://github.com/folio-org/ui-orders/tree/v3.3.0) (2022-10-27)
[Full Changelog](https://github.com/folio-org/ui-orders/compare/v3.2.2...v3.3.0)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@
},
"dependencies": {
"@folio/plugin-find-po-line": "^3.2.0",
"@folio/stripes-acq-components": "~3.3.0",
"@folio/stripes-acq-components": "~3.4.0",
"classnames": "^2.2.5",
"final-form": "^4.19.1",
"lodash": "^4.17.19",
Expand Down
3 changes: 2 additions & 1 deletion src/settings/AcquisitionMethods/AcquisitionMethods.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { stripesShape } from '@folio/stripes/core';
import { ControlledVocab } from '@folio/stripes/smart-components';
import {
ACQUISITION_METHODS_API,
getControlledVocabTranslations,
} from '@folio/stripes-acq-components';

import { getTranslatedAcqMethod } from '../../components/Utils/getTranslatedAcqMethod';
Expand Down Expand Up @@ -49,7 +50,7 @@ class AcquisitionMethods extends Component {
nameKey="value"
editable={stripes.hasPerm('ui-orders.settings.all')}
label={intl.formatMessage({ id: 'ui-orders.settings.acquisitionMethods' })}
labelSingular={intl.formatMessage({ id: 'ui-orders.settings.acquisitionMethods.singular' })}
translations={getControlledVocabTranslations('ui-orders.settings.acquisitionMethods')}
columnMapping={columnMapping}
objectLabel={intl.formatMessage({ id: 'ui-orders.settings.acquisitionMethods.singular' })}
formatter={formatter}
Expand Down
3 changes: 2 additions & 1 deletion src/settings/ClosingReasons/ClosingReasons.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import PropTypes from 'prop-types';

import { stripesShape } from '@folio/stripes/core';
import { ControlledVocab } from '@folio/stripes/smart-components';
import { getControlledVocabTranslations } from '@folio/stripes-acq-components';

import {
CLOSING_REASONS_SOURCE,
Expand Down Expand Up @@ -68,7 +69,7 @@ class ClosingReasons extends Component {
hiddenFields={hiddenFields}
id="closingReasons"
label={intl.formatMessage({ id: 'ui-orders.settings.closingOrderReasons' })}
labelSingular={intl.formatMessage({ id: 'ui-orders.settings.closingReasons.reason' })}
translations={getControlledVocabTranslations('ui-orders.settings.closingReasons')}
nameKey="reason"
objectLabel={reasonsLabel}
readOnlyFields={readOnlyFields}
Expand Down
7 changes: 5 additions & 2 deletions src/settings/Prefixes/Prefixes.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import PropTypes from 'prop-types';

import { stripesShape } from '@folio/stripes/core';
import { ControlledVocab } from '@folio/stripes/smart-components';
import { PREFIXES_API } from '@folio/stripes-acq-components';
import {
getControlledVocabTranslations,
PREFIXES_API,
} from '@folio/stripes-acq-components';

import { validatePrefixSuffixName } from '../utils';

Expand Down Expand Up @@ -35,7 +38,7 @@ class Prefixes extends Component {
hiddenFields={prefixHiddenFields}
id="prefixes"
label={intl.formatMessage({ id: 'ui-orders.settings.poNumber.prefixes' })}
labelSingular={intl.formatMessage({ id: 'ui-orders.settings.poNumber.prefix' })}
translations={getControlledVocabTranslations('ui-orders.settings.poNumber.prefix')}
nameKey="name"
objectLabel={intl.formatMessage({ id: 'ui-orders.settings.poNumber.prefix' })}
records="prefixes"
Expand Down
7 changes: 5 additions & 2 deletions src/settings/Suffixes/Suffixes.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import PropTypes from 'prop-types';

import { stripesShape } from '@folio/stripes/core';
import { ControlledVocab } from '@folio/stripes/smart-components';
import { SUFFIXES_API } from '@folio/stripes-acq-components';
import {
getControlledVocabTranslations,
SUFFIXES_API,
} from '@folio/stripes-acq-components';

import { validatePrefixSuffixName } from '../utils';

Expand All @@ -34,7 +37,7 @@ class Suffixes extends Component {
editable
id="suffixes"
label={intl.formatMessage({ id: 'ui-orders.settings.poNumber.suffixes' })}
labelSingular={intl.formatMessage({ id: 'ui-orders.settings.poNumber.suffix' })}
translations={getControlledVocabTranslations('ui-orders.settings.poNumber.suffix')}
nameKey="name"
objectLabel={intl.formatMessage({ id: 'ui-orders.settings.poNumber.suffix' })}
records="suffixes"
Expand Down
22 changes: 21 additions & 1 deletion translations/ui-orders/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,9 @@
"settings.closingReasons.add": "Add reason",
"settings.closingReasons.addBtn": "Add",
"settings.closingReasons.cancelBtn": "Cancel",
"settings.closingReasons.cannotDeleteTermHeader": "Cannot delete the closing reason",
"settings.closingReasons.cannotDeleteTermMessage": "This closing reason cannot be deleted, as it is in use by one or more records.",
"settings.closingReasons.deleteEntry": "Delete closing reason",
"settings.closingReasons.editBtn": "Edit",
"settings.closingReasons.reason": "Reason",
"settings.closingReasons.remove.error": "Reason has not been removed",
Expand All @@ -639,6 +642,8 @@
"settings.closingReasons.save.success": "Reason has been successfully saved",
"settings.closingReasons.saveBtn": "Save",
"settings.closingReasons.System": "System",
"settings.closingReasons.termDeleted": "The closing reason <b>{term}</b> was successfully <b>deleted</b>",
"settings.closingReasons.termWillBeDeleted": "The closing reason <b>{term}</b> will be <b>deleted.</b>",
"settings.closingReasons.User": "User",
"settings.closingReasons.source": "Source",
"settings.createInventory.eresource": "Electronic default",
Expand Down Expand Up @@ -716,8 +721,18 @@
"settings.poNumber.modifier.description": "Description",
"settings.poNumber.prefixes": "Prefixes",
"settings.poNumber.prefix": "Prefix",
"settings.poNumber.prefix.cannotDeleteTermHeader": "Cannot delete the prefix",
"settings.poNumber.prefix.cannotDeleteTermMessage": "This prefix cannot be deleted, as it is in use by one or more records.",
"settings.poNumber.prefix.deleteEntry": "Delete prefix",
"settings.poNumber.prefix.termDeleted": "The prefix <b>{term}</b> was successfully <b>deleted</b>",
"settings.poNumber.prefix.termWillBeDeleted": "The prefix <b>{term}</b> will be <b>deleted.</b>",
"settings.poNumber.suffixes": "Suffixes",
"settings.poNumber.suffix": "Suffix",
"settings.poNumber.suffix.cannotDeleteTermHeader": "Cannot delete the suffix",
"settings.poNumber.suffix.cannotDeleteTermMessage": "This suffix cannot be deleted, as it is in use by one or more records.",
"settings.poNumber.suffix.deleteEntry": "Delete suffix",
"settings.poNumber.suffix.termDeleted": "The suffix <b>{term}</b> was successfully <b>deleted</b>",
"settings.poNumber.suffix.termWillBeDeleted": "The suffix <b>{term}</b> will be <b>deleted.</b>",
"settings.poNumber.nameValidation": "Name is not valid",
"settings.poNumber": "Purchase order number",
"settings.saveBtn": "Save",
Expand All @@ -726,8 +741,13 @@
"settings.setPOLInesLimit": "Set purchase order lines limit",

"settings.acquisitionMethods": "Acquisition methods",
"settings.acquisitionMethods.singular": "Acquisition method",
"settings.acquisitionMethods.cannotDeleteTermHeader": "Cannot delete the acquisition method",
"settings.acquisitionMethods.cannotDeleteTermMessage": "This acquisition method cannot be deleted, as it is in use by one or more records.",
"settings.acquisitionMethods.deleteEntry": "Delete acquisition method",
"settings.acquisitionMethods.name": "Name",
"settings.acquisitionMethods.singular": "Acquisition method",
"settings.acquisitionMethods.termDeleted": "The acquisition method <b>{term}</b> was successfully <b>deleted</b>",
"settings.acquisitionMethods.termWillBeDeleted": "The acquisition method <b>{term}</b> will be <b>deleted.</b>",

"shortcut.duplicateRecord": "Duplicate a record",
"shortcut.addPOL": "Add POL",
Expand Down

0 comments on commit 6a9dea3

Please sign in to comment.