@procore/core-react 12.31.0 → 12.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/AnchorNavigation/AnchorNavigation.styles.js +3 -3
- package/dist/Avatar/Avatar.js +20 -12
- package/dist/Avatar/Avatar.js.map +1 -1
- package/dist/Avatar/Avatar.styles.js +5 -5
- package/dist/AvatarStack/AvatarStack.styles.js +7 -7
- package/dist/Badge/Badge.styles.js +2 -2
- package/dist/BadgePill/BadgePill.styles.js +4 -4
- package/dist/Banner/Banner.styles.js +10 -10
- package/dist/Box/Box.styles.js +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.styles.js +4 -4
- package/dist/Button/Button.styles.js +5 -5
- package/dist/Calendar/Calendar.styles.js +8 -8
- package/dist/Card/Card.styles.js +1 -1
- package/dist/Checkbox/Checkbox.styles.js +6 -6
- package/dist/Checkbox/CheckboxTooltip.js +1 -1
- package/dist/ContactItem/ContactItem.styles.js +5 -5
- package/dist/Content/Content.styles.js +2 -2
- package/dist/DateInput/DateInput.styles.js +6 -6
- package/dist/DetailPage/DetailPage.styles.js +7 -7
- package/dist/Dropdown/Dropdown.styles.js +3 -3
- package/dist/DropdownFlyout/DropdownFlyout.styles.js +4 -4
- package/dist/Dropzone/Dropzone.js +1 -1
- package/dist/Dropzone/Dropzone.styles.js +9 -9
- package/dist/EmptyState/EmptyState.styles.js +6 -6
- package/dist/Field/Field.styles.js +3 -3
- package/dist/FileList/FileList.styles.js +4 -4
- package/dist/FileSelect/FileExplorer/FileExplorer.styles.js +9 -9
- package/dist/FileSelect/FileExplorer/FileExplorerSidebar.styles.js +3 -3
- package/dist/FileSelect/FileSelect.styles.js +2 -2
- package/dist/FileSelect/FileSelectDropzone/FileSelectDropzone.styles.js +3 -3
- package/dist/FileSelect/FileTokenList/FileTokenList.styles.js +2 -2
- package/dist/FileSelect/GridSource/GridSource.styles.js +6 -6
- package/dist/FileSelect/LocalSource/LocalSource.styles.js +4 -4
- package/dist/FileSelect/SourceItem/SourceItem.styles.js +3 -3
- package/dist/FileSelect/ThumbnailList/ThumbnailList.styles.js +6 -6
- package/dist/FileSelect/TreeSource/TreeSource.styles.js +1 -1
- package/dist/FileToken/FileToken.styles.js +4 -4
- package/dist/FilterToken/FilterToken.styles.js +5 -5
- package/dist/FlexList/FlexList.styles.js +1 -1
- package/dist/Form/Form.js +10 -5
- package/dist/Form/Form.js.map +1 -1
- package/dist/Form/Form.styles.js +14 -14
- package/dist/Form/Form.types.d.ts +2 -0
- package/dist/Form/Form.types.js.map +1 -1
- package/dist/Form/StyledFormikForm.styles.js +2 -2
- package/dist/GhostPlaceholder/GhostPlaceholder.styles.js +2 -2
- package/dist/Grid/Grid.styles.js +2 -2
- package/dist/GroupSelect/GroupSelect.styles.js +1 -1
- package/dist/Input/Input.js +1 -0
- package/dist/Input/Input.js.map +1 -1
- package/dist/Input/Input.styles.js +1 -1
- package/dist/Link/Link.styles.js +1 -1
- package/dist/ListPage/ListPage.styles.js +8 -8
- package/dist/Loader/Loader.styles.js +2 -2
- package/dist/MenuImperative/MenuImperative.styles.js +10 -10
- package/dist/Modal/Modal.styles.js +13 -13
- package/dist/MultiSelect/MultiSelect.styles.js +6 -6
- package/dist/NextMenu/NextMenu.styles.js +3 -3
- package/dist/NextTile/NextTile.js +119 -45
- package/dist/NextTile/NextTile.js.map +1 -1
- package/dist/Notation/Notation.js +1 -1
- package/dist/NumberInput/NumberInput.styles.js +7 -7
- package/dist/Overlay/OverlayArrow.styles.js +1 -1
- package/dist/PageLayout/PageLayout.styles.js +16 -16
- package/dist/PageTemplate/PageFooterTemplate/PageFooterTemplate.styles.js +1 -1
- package/dist/PageTemplate/PageHeaderTemplate/PageHeaderTemplate.styles.js +3 -3
- package/dist/PageTemplate/PagePaneTemplate/PagePaneTemplate.styles.js +2 -2
- package/dist/PageTemplate/PageTemplate/PageTemplate.styles.js +3 -3
- package/dist/Pagination/Pagination.styles.js +5 -5
- package/dist/Panel/Panel.styles.js +11 -11
- package/dist/Pill/Pill.styles.js +3 -3
- package/dist/PillSelect/PillSelect.styles.js +4 -4
- package/dist/Popover/Popover.styles.js +2 -2
- package/dist/Portal/Portal.styles.js +1 -1
- package/dist/ProgressBar/ProgressBar.styles.js +2 -2
- package/dist/RadioButton/RadioButton.styles.js +3 -3
- package/dist/Required/Required.styles.js +3 -3
- package/dist/Search/Search.styles.js +5 -5
- package/dist/Section/Section.styles.js +7 -7
- package/dist/SegmentedController/SegmentedController.js +86 -25
- package/dist/SegmentedController/SegmentedController.js.map +1 -1
- package/dist/SegmentedController/SegmentedController.styles.js +4 -4
- package/dist/Select/Select.styles.js +7 -7
- package/dist/Semantic/Semantic.styles.js +9 -9
- package/dist/Slider/Slider.styles.js +5 -5
- package/dist/Spinner/Spinner.styles.js +7 -7
- package/dist/SplitViewCard/SplitViewCard.styles.js +8 -8
- package/dist/SuperSelect/SuperSelect.presets.styles.js +1 -1
- package/dist/SuperSelect/SuperSelect.styles.js +38 -38
- package/dist/Switch/Switch.styles.js +4 -4
- package/dist/Table/Table.styles.js +28 -28
- package/dist/TableShelf/TableShelf.styles.js +5 -5
- package/dist/Tabs/Tabs.js +19 -13
- package/dist/Tabs/Tabs.js.map +1 -1
- package/dist/Tabs/Tabs.styles.js +15 -15
- package/dist/Tearsheet/Tearsheet.styles.js +5 -5
- package/dist/TextArea/TextArea.styles.js +1 -1
- package/dist/TextEditorOutput/TextEditorOutput.styles.js +1 -1
- package/dist/Thumbnail/Thumbnail.styles.js +17 -17
- package/dist/ThumbnailGrid/ThumbnailGrid.styles.js +7 -7
- package/dist/TieredSelect/TieredSelect.styles.js +9 -9
- package/dist/Tile/Tile.styles.js +8 -8
- package/dist/Title/Title.styles.js +7 -7
- package/dist/Toast/Toast.styles.js +3 -3
- package/dist/ToggleButton/ToggleButton.styles.js +1 -1
- package/dist/Token/Token.styles.js +3 -3
- package/dist/ToolHeader/ToolHeader.styles.js +6 -6
- package/dist/ToolLandingPage/ToolLandingPage.js +14 -7
- package/dist/ToolLandingPage/ToolLandingPage.js.map +1 -1
- package/dist/ToolLandingPage/ToolLandingPage.styles.js +3 -3
- package/dist/ToolLandingPage/ToolLandingPage.types.d.ts +29 -0
- package/dist/ToolLandingPage/ToolLandingPage.types.js.map +1 -1
- package/dist/Tooltip/Tooltip.styles.js +2 -2
- package/dist/Tree/Tree.styles.js +9 -9
- package/dist/Typeahead/Typeahead.styles.js +3 -3
- package/dist/Typography/Typography.styles.js +1 -1
- package/dist/Typography/Typography.table.story.js +2 -2
- package/dist/_hooks/I18n.d.ts +50 -46
- package/dist/_hooks/I18n.js +2 -0
- package/dist/_hooks/I18n.js.map +1 -1
- package/dist/_hooks/getI18nProviderLocale.js +1 -1
- package/dist/_hooks/getI18nProviderLocale.js.map +1 -1
- package/dist/_locales/de-DE.json +2 -2
- package/dist/_locales/en-AU.json +1 -1
- package/dist/_locales/en-CA.json +1 -1
- package/dist/_locales/en-GB.json +1 -1
- package/dist/_locales/es-ES.json +1 -1
- package/dist/_locales/es.json +3 -3
- package/dist/_locales/fr-CA.json +2 -2
- package/dist/_locales/fr-FR.json +2 -2
- package/dist/_locales/is-IS.json +2 -2
- package/dist/_locales/it-IT.json +47 -47
- package/dist/_locales/ja-JP.json +1 -1
- package/dist/_locales/pl-PL.json +1 -1
- package/dist/_locales/pt-BR.json +2 -2
- package/dist/_locales/pt-PT.json +89 -89
- package/dist/_locales/th-TH.json +4 -4
- package/dist/_locales/zh-SG.json +1 -1
- package/dist/_locales/zh-TW.json +4 -4
- package/dist/_storyHelpers_/components/Deprecation.styles.js +1 -1
- package/dist/_storyHelpers_/components/StoryGrid.js +3 -3
- package/dist/_typedoc/AnchorNavigation/AnchorNavigation.types.json +3 -3
- package/dist/_typedoc/Avatar/Avatar.types.json +20 -20
- package/dist/_typedoc/AvatarStack/AvatarStack.types.json +24 -24
- package/dist/_typedoc/Badge/Badge.types.json +6 -6
- package/dist/_typedoc/Banner/Banner.types.json +13 -13
- package/dist/_typedoc/Box/Box.types.json +68 -68
- package/dist/_typedoc/Breadcrumbs/Breadcrumbs.types.json +10 -10
- package/dist/_typedoc/Button/Button.types.json +13 -13
- package/dist/_typedoc/Calendar/Calendar.types.json +80 -80
- package/dist/_typedoc/Card/Card.types.json +6 -6
- package/dist/_typedoc/Checkbox/Checkbox.types.json +8 -8
- package/dist/_typedoc/ContactItem/ContactItem.types.json +9 -9
- package/dist/_typedoc/DateInput/DateInput.types.json +35 -35
- package/dist/_typedoc/DateSelect/DateSelect.types.json +13 -13
- package/dist/_typedoc/DetailPage/DetailPage.types.json +5 -5
- package/dist/_typedoc/Dropdown/Dropdown.types.json +37 -37
- package/dist/_typedoc/DropdownFlyout/DropdownFlyout.types.json +30 -30
- package/dist/_typedoc/Dropzone/Dropzone.types.json +44 -44
- package/dist/_typedoc/EmptyState/EmptyState.types.json +16 -16
- package/dist/_typedoc/FileList/FileList.types.json +9 -9
- package/dist/_typedoc/FileSelect/FileSelect.types.json +27 -27
- package/dist/_typedoc/FileSelect/GridSource/GridSource.types.json +20 -20
- package/dist/_typedoc/FileSelect/LocalSource/LocalSource.types.json +14 -14
- package/dist/_typedoc/FileSelect/TreeSource/TreeSource.types.json +9 -9
- package/dist/_typedoc/Flex/Flex.types.json +27 -27
- package/dist/_typedoc/FlexList/FlexList.types.json +30 -30
- package/dist/_typedoc/Form/Form.types.json +753 -743
- package/dist/_typedoc/GhostPlaceholder/GhostPlaceholder.types.json +12 -12
- package/dist/_typedoc/Grid/Grid.types.json +8 -8
- package/dist/_typedoc/GroupSelect/GroupSelect.types.json +52 -52
- package/dist/_typedoc/Input/Input.types.json +2 -2
- package/dist/_typedoc/Link/Link.types.json +1 -1
- package/dist/_typedoc/ListPage/ListPage.types.json +13 -13
- package/dist/_typedoc/Menu/Menu.types.json +62 -62
- package/dist/_typedoc/MenuImperative/MenuImperative.types.json +77 -77
- package/dist/_typedoc/Modal/Modal.types.json +46 -46
- package/dist/_typedoc/MultiSelect/MultiSelect.types.json +31 -31
- package/dist/_typedoc/NextTile/NextTile.types.json +32 -32
- package/dist/_typedoc/Notation/Notation.types.json +4 -4
- package/dist/_typedoc/NumberInput/NumberInput.types.json +48 -48
- package/dist/_typedoc/OverlayTrigger/OverlayTrigger.types.json +32 -32
- package/dist/_typedoc/PageLayout/PageLayout.types.json +26 -26
- package/dist/_typedoc/Pagination/Pagination.types.json +7 -7
- package/dist/_typedoc/Panel/Panel.types.json +30 -30
- package/dist/_typedoc/Pill/Pill.types.json +2 -2
- package/dist/_typedoc/PillSelect/PillSelect.types.json +49 -49
- package/dist/_typedoc/Popover/Popover.types.json +15 -15
- package/dist/_typedoc/ProgressBar/ProgressBar.types.json +7 -7
- package/dist/_typedoc/RadioButton/RadioButton.types.json +6 -6
- package/dist/_typedoc/Required/Required.types.json +5 -5
- package/dist/_typedoc/Search/Search.types.json +18 -18
- package/dist/_typedoc/Section/Section.types.json +15 -15
- package/dist/_typedoc/SegmentedController/SegmentedController.types.json +21 -21
- package/dist/_typedoc/Select/Select.types.json +60 -60
- package/dist/_typedoc/SettingsPage/SettingsPage.types.json +10 -10
- package/dist/_typedoc/Slider/Slider.types.json +6 -6
- package/dist/_typedoc/Spinner/Spinner.types.json +9 -9
- package/dist/_typedoc/SplitViewCard/SplitViewCard.types.json +14 -14
- package/dist/_typedoc/Table/Table.types.json +101 -101
- package/dist/_typedoc/Tabs/Tabs.types.json +20 -20
- package/dist/_typedoc/Tearsheet/Tearsheet.types.json +17 -17
- package/dist/_typedoc/TextArea/TextArea.types.json +3 -3
- package/dist/_typedoc/TextEditor/TextEditor.types.json +9 -9
- package/dist/_typedoc/TextEditorOutput/TextEditorOutput.types.json +4 -4
- package/dist/_typedoc/Thumbnail/Thumbnail.types.json +19 -19
- package/dist/_typedoc/TieredDropdown/TieredDropdown.types.json +42 -42
- package/dist/_typedoc/TieredSelect/TieredSelect.types.json +28 -28
- package/dist/_typedoc/Tile/Tile.types.json +8 -8
- package/dist/_typedoc/Title/Title.types.json +1 -1
- package/dist/_typedoc/Toast/Toast.types.json +4 -4
- package/dist/_typedoc/ToggleButton/ToggleButton.types.json +4 -4
- package/dist/_typedoc/Token/Token.types.json +7 -7
- package/dist/_typedoc/ToolHeader/ToolHeader.types.json +10 -10
- package/dist/_typedoc/ToolLandingPage/ToolLandingPage.types.json +19 -8
- package/dist/_typedoc/Tooltip/Tooltip.types.json +13 -13
- package/dist/_typedoc/Tree/Tree.types.json +86 -86
- package/dist/_typedoc/Typeahead/Typeahead.types.json +2 -2
- package/dist/_typedoc/Typography/Typography.types.json +9 -9
- package/dist/_typedoc/_utils/types.json +3 -3
- package/dist/_typedoc/deprecations.json +1 -1
- package/package.json +14 -14
package/dist/Tree/Tree.styles.js
CHANGED
|
@@ -5,11 +5,11 @@ import { Typography } from '../Typography/Typography';
|
|
|
5
5
|
import { colors } from '../_styles/colors';
|
|
6
6
|
export var StyledFilenameCaption = /*#__PURE__*/styled(Typography).withConfig({
|
|
7
7
|
displayName: "StyledFilenameCaption",
|
|
8
|
-
componentId: "core-
|
|
8
|
+
componentId: "core-12_33_0__sc-2d45b5-0"
|
|
9
9
|
})(["display:flex;width:100%;"]);
|
|
10
10
|
export var StyledTree = /*#__PURE__*/styled.div.withConfig({
|
|
11
11
|
displayName: "StyledTree",
|
|
12
|
-
componentId: "core-
|
|
12
|
+
componentId: "core-12_33_0__sc-2d45b5-1"
|
|
13
13
|
})(["width:100%;height:100%;min-height:36px;outline:none;overflow:auto;"]);
|
|
14
14
|
export var StyledTreeRowContainer = /*#__PURE__*/styled(Typography).withConfig({
|
|
15
15
|
shouldForwardProp: function shouldForwardProp(prop) {
|
|
@@ -17,7 +17,7 @@ export var StyledTreeRowContainer = /*#__PURE__*/styled(Typography).withConfig({
|
|
|
17
17
|
}
|
|
18
18
|
}).withConfig({
|
|
19
19
|
displayName: "StyledTreeRowContainer",
|
|
20
|
-
componentId: "core-
|
|
20
|
+
componentId: "core-12_33_0__sc-2d45b5-2"
|
|
21
21
|
})(["display:flex;align-items:center;height:36px;background:transparent;box-shadow:inset 4px 0px 0px transparent;cursor:default;outline:none;", " &:hover{background:", ";}", " ", ""], function (_ref) {
|
|
22
22
|
var isSelectable = _ref.isSelectable,
|
|
23
23
|
$isSelectable = _ref.$isSelectable;
|
|
@@ -35,30 +35,30 @@ export var StyledTreeRowContainer = /*#__PURE__*/styled(Typography).withConfig({
|
|
|
35
35
|
});
|
|
36
36
|
export var StyledTreeRowContent = /*#__PURE__*/styled.div.withConfig({
|
|
37
37
|
displayName: "StyledTreeRowContent",
|
|
38
|
-
componentId: "core-
|
|
38
|
+
componentId: "core-12_33_0__sc-2d45b5-3"
|
|
39
39
|
})(["display:flex;align-items:center;"]);
|
|
40
40
|
export var StyledTreeRowWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
41
41
|
displayName: "StyledTreeRowWrapper",
|
|
42
|
-
componentId: "core-
|
|
42
|
+
componentId: "core-12_33_0__sc-2d45b5-4"
|
|
43
43
|
})(["outline:none;"]);
|
|
44
44
|
var StyledIconBase = /*#__PURE__*/styled(Box).withConfig({
|
|
45
45
|
displayName: "StyledIconBase",
|
|
46
|
-
componentId: "core-
|
|
46
|
+
componentId: "core-12_33_0__sc-2d45b5-5"
|
|
47
47
|
})(["display:flex;justify-content:center;align-items:center;width:24px;height:24px;min-width:24px;min-height:24px;"]);
|
|
48
48
|
export var StyledChevronContainer = /*#__PURE__*/styled(StyledIconBase).withConfig({
|
|
49
49
|
displayName: "StyledChevronContainer",
|
|
50
|
-
componentId: "core-
|
|
50
|
+
componentId: "core-12_33_0__sc-2d45b5-6"
|
|
51
51
|
})([""]);
|
|
52
52
|
export var StyledIconContainer = /*#__PURE__*/styled(StyledIconBase).withConfig({
|
|
53
53
|
displayName: "StyledIconContainer",
|
|
54
|
-
componentId: "core-
|
|
54
|
+
componentId: "core-12_33_0__sc-2d45b5-7"
|
|
55
55
|
})(["color:", ";"], function (_ref4) {
|
|
56
56
|
var $isSelected = _ref4.$isSelected;
|
|
57
57
|
return $isSelected ? colors.blue45 : colors.gray40;
|
|
58
58
|
});
|
|
59
59
|
export var StyledChevron = /*#__PURE__*/styled(ChevronRight).withConfig({
|
|
60
60
|
displayName: "StyledChevron",
|
|
61
|
-
componentId: "core-
|
|
61
|
+
componentId: "core-12_33_0__sc-2d45b5-8"
|
|
62
62
|
})(["transform:rotate(", "deg);transition:transform 150ms ease-out;"], function (_ref5) {
|
|
63
63
|
var $isExpanded = _ref5.$isExpanded;
|
|
64
64
|
return $isExpanded ? 90 : 0;
|
|
@@ -5,11 +5,11 @@ import { spacing } from '../_styles/spacing';
|
|
|
5
5
|
var inputHeight = 36;
|
|
6
6
|
export var StyledInput = /*#__PURE__*/styled.input.withConfig({
|
|
7
7
|
displayName: "StyledInput",
|
|
8
|
-
componentId: "core-
|
|
8
|
+
componentId: "core-12_33_0__sc-gpc39h-0"
|
|
9
9
|
})(["", " padding-right:", "px;"], getSearchInputStyles(), spacing.xxl);
|
|
10
10
|
export var StyledIcon = /*#__PURE__*/styled.div.withConfig({
|
|
11
11
|
displayName: "StyledIcon",
|
|
12
|
-
componentId: "core-
|
|
12
|
+
componentId: "core-12_33_0__sc-gpc39h-1"
|
|
13
13
|
})(["align-items:center;color:", ";display:flex;height:", "px;justify-content:center;pointer-events:", ";position:absolute;right:0;top:0;width:", "px;"], function (p) {
|
|
14
14
|
return p.disabled ? colors.gray70 : colors.gray45;
|
|
15
15
|
}, inputHeight, function (p) {
|
|
@@ -17,6 +17,6 @@ export var StyledIcon = /*#__PURE__*/styled.div.withConfig({
|
|
|
17
17
|
}, inputHeight);
|
|
18
18
|
export var StyledTypeahead = /*#__PURE__*/styled.div.withConfig({
|
|
19
19
|
displayName: "StyledTypeahead",
|
|
20
|
-
componentId: "core-
|
|
20
|
+
componentId: "core-12_33_0__sc-gpc39h-2"
|
|
21
21
|
})(["position:relative;width:100%;"]);
|
|
22
22
|
//# sourceMappingURL=Typeahead.styles.js.map
|
|
@@ -35,7 +35,7 @@ export var semiboldRules = function semiboldRules() {
|
|
|
35
35
|
};
|
|
36
36
|
export var StyledTypography = /*#__PURE__*/styled.span.withConfig({
|
|
37
37
|
displayName: "StyledTypography",
|
|
38
|
-
componentId: "core-
|
|
38
|
+
componentId: "core-12_33_0__sc-1c4583t-0"
|
|
39
39
|
})(["", " color:", ";font-style:", ";font-weight:", ";", " ", " em,i{font-style:italic;}"], function (_ref) {
|
|
40
40
|
var _ref$$intent = _ref.$intent,
|
|
41
41
|
$intent = _ref$$intent === void 0 ? 'body' : _ref$$intent;
|
|
@@ -5,11 +5,11 @@ import { colors } from '../_styles/colors';
|
|
|
5
5
|
import { getTypographyIntent } from './Typography.styles';
|
|
6
6
|
var StyledBodyCell = /*#__PURE__*/styled(Table.BodyCell).withConfig({
|
|
7
7
|
displayName: "StyledBodyCell",
|
|
8
|
-
componentId: "core-
|
|
8
|
+
componentId: "core-12_33_0__sc-p4v7d-0"
|
|
9
9
|
})([""]);
|
|
10
10
|
var StyledTextCell = /*#__PURE__*/styled(Table.TextCell).withConfig({
|
|
11
11
|
displayName: "StyledTextCell",
|
|
12
|
-
componentId: "core-
|
|
12
|
+
componentId: "core-12_33_0__sc-p4v7d-1"
|
|
13
13
|
})(["", " color:", ";"], getTypographyIntent('body'), colors.blue50);
|
|
14
14
|
function BodyCell() {
|
|
15
15
|
return /*#__PURE__*/React.createElement(StyledBodyCell, {
|
package/dist/_hooks/I18n.d.ts
CHANGED
|
@@ -471,14 +471,7 @@ export declare const coreTranslations: {
|
|
|
471
471
|
};
|
|
472
472
|
itemName: string;
|
|
473
473
|
loading: string;
|
|
474
|
-
notes: string;
|
|
475
|
-
* Hook to create I18n object.
|
|
476
|
-
* @param {UseI18n} props - The I18n configuration.
|
|
477
|
-
* @param {string} props.locale - The locale to use.
|
|
478
|
-
* @param {Record<string, string>} props.translations - The translations to use.
|
|
479
|
-
* @param {boolean} props.enableCDN - Whether to pull core-react translations from the CDN or not, by default it follows the value passed down through the parent I18nProvider.
|
|
480
|
-
* @returns {I18nWithCDNFlag} The I18n object.
|
|
481
|
-
*/
|
|
474
|
+
notes: string;
|
|
482
475
|
notesPlaceholder: string;
|
|
483
476
|
newItem: string;
|
|
484
477
|
noRelatedItems: {
|
|
@@ -2370,14 +2363,7 @@ export declare const coreTranslations: {
|
|
|
2370
2363
|
noCompany: string;
|
|
2371
2364
|
peopleCount: string;
|
|
2372
2365
|
distributionGroups: string;
|
|
2373
|
-
people: string;
|
|
2374
|
-
* Hook to create I18n object.
|
|
2375
|
-
* @param {UseI18n} props - The I18n configuration.
|
|
2376
|
-
* @param {string} props.locale - The locale to use.
|
|
2377
|
-
* @param {Record<string, string>} props.translations - The translations to use.
|
|
2378
|
-
* @param {boolean} props.enableCDN - Whether to pull core-react translations from the CDN or not, by default it follows the value passed down through the parent I18nProvider.
|
|
2379
|
-
* @returns {I18nWithCDNFlag} The I18n object.
|
|
2380
|
-
*/
|
|
2366
|
+
people: string;
|
|
2381
2367
|
};
|
|
2382
2368
|
relatedItems: {
|
|
2383
2369
|
cancel: string;
|
|
@@ -3570,6 +3556,15 @@ export declare const coreTranslations: {
|
|
|
3570
3556
|
timeOnDate: string;
|
|
3571
3557
|
};
|
|
3572
3558
|
table: {
|
|
3559
|
+
/**
|
|
3560
|
+
* Provider to wrap the application with the I18n context.
|
|
3561
|
+
* @param {PropsWithChildren<UseI18n>} props - The I18n configuration.
|
|
3562
|
+
* @param {React.ReactNode} props.children - The children to render.
|
|
3563
|
+
* @param {UseI18n} props.locale - The locale to use.
|
|
3564
|
+
* @param {Record<string, string>} props.translations - The translations to use.
|
|
3565
|
+
* @param {boolean} props.enableCDN - Whether to pull core-react translations from the CDN or not, by default it follows the value passed down through the parent I18nProvider.
|
|
3566
|
+
* @returns {React.ReactNode} The I18n context instance.
|
|
3567
|
+
*/
|
|
3573
3568
|
checkboxLabel: string;
|
|
3574
3569
|
sortableColumn: string;
|
|
3575
3570
|
};
|
|
@@ -4274,7 +4269,13 @@ export declare const coreTranslations: {
|
|
|
4274
4269
|
emptyStateTitle: string;
|
|
4275
4270
|
emptyStateDescription: string;
|
|
4276
4271
|
reply: string;
|
|
4277
|
-
cancel: string;
|
|
4272
|
+
cancel: string;
|
|
4273
|
+
subject: string;
|
|
4274
|
+
subjectPlaceholder: string;
|
|
4275
|
+
};
|
|
4276
|
+
distributionSelect: {
|
|
4277
|
+
noCompany: string;
|
|
4278
|
+
/**
|
|
4278
4279
|
* Hook to create I18n object.
|
|
4279
4280
|
* @param {UseI18n} props - The I18n configuration.
|
|
4280
4281
|
* @param {string} props.locale - The locale to use.
|
|
@@ -4282,11 +4283,6 @@ export declare const coreTranslations: {
|
|
|
4282
4283
|
* @param {boolean} props.enableCDN - Whether to pull core-react translations from the CDN or not, by default it follows the value passed down through the parent I18nProvider.
|
|
4283
4284
|
* @returns {I18nWithCDNFlag} The I18n object.
|
|
4284
4285
|
*/
|
|
4285
|
-
subject: string;
|
|
4286
|
-
subjectPlaceholder: string;
|
|
4287
|
-
};
|
|
4288
|
-
distributionSelect: {
|
|
4289
|
-
noCompany: string;
|
|
4290
4286
|
peopleCount: string;
|
|
4291
4287
|
distributionGroups: string;
|
|
4292
4288
|
people: string;
|
|
@@ -5099,15 +5095,7 @@ export declare const coreTranslations: {
|
|
|
5099
5095
|
dateTimeFormat: {
|
|
5100
5096
|
dateAtTime: string;
|
|
5101
5097
|
timeOnDate: string;
|
|
5102
|
-
};
|
|
5103
|
-
* Provider to wrap the application with the I18n context.
|
|
5104
|
-
* @param {PropsWithChildren<UseI18n>} props - The I18n configuration.
|
|
5105
|
-
* @param {React.ReactNode} props.children - The children to render.
|
|
5106
|
-
* @param {UseI18n} props.locale - The locale to use.
|
|
5107
|
-
* @param {Record<string, string>} props.translations - The translations to use.
|
|
5108
|
-
* @param {boolean} props.enableCDN - Whether to pull core-react translations from the CDN or not, by default it follows the value passed down through the parent I18nProvider.
|
|
5109
|
-
* @returns {React.ReactNode} The I18n context instance.
|
|
5110
|
-
*/
|
|
5098
|
+
};
|
|
5111
5099
|
table: {
|
|
5112
5100
|
checkboxLabel: string;
|
|
5113
5101
|
sortableColumn: string;
|
|
@@ -5219,6 +5207,17 @@ export declare const coreTranslations: {
|
|
|
5219
5207
|
};
|
|
5220
5208
|
};
|
|
5221
5209
|
fileAttacher: {
|
|
5210
|
+
/**
|
|
5211
|
+
* Hook to access the I18n context.
|
|
5212
|
+
*
|
|
5213
|
+
* @template Translations - An optional generic to provide type safety for translations.
|
|
5214
|
+
* If specified, it enables typed access to the `t` and `translate` methods of the I18n instance.
|
|
5215
|
+
* These methods will have type safe access to both the tranlsation scope as well as the interpolation variables.
|
|
5216
|
+
* If not specified, the default I18nWithCDN instance is returned.
|
|
5217
|
+
*
|
|
5218
|
+
* @returns {I18nWithCDNFlag | I18njsWithTypedTranslate<Translations>} The I18n context instance,
|
|
5219
|
+
* either with or without typed translations based on the provided generic.
|
|
5220
|
+
*/
|
|
5222
5221
|
attachFiles: {
|
|
5223
5222
|
one: string;
|
|
5224
5223
|
other: string;
|
|
@@ -5416,11 +5415,7 @@ export declare const coreTranslations: {
|
|
|
5416
5415
|
downloadAll: string;
|
|
5417
5416
|
showAll: string;
|
|
5418
5417
|
showLess: string;
|
|
5419
|
-
composeEmailPageTitle: string;
|
|
5420
|
-
* @deprecated this type will no longer be supported from core-i18n-js,
|
|
5421
|
-
* to have a type safe Locale use TmsSupportedLocale or AllLocales from [Globalization toolkit](https://github.com/procore/globalization-toolkit)
|
|
5422
|
-
* @deprecatedSince 12.10.0
|
|
5423
|
-
*/
|
|
5418
|
+
composeEmailPageTitle: string;
|
|
5424
5419
|
emailSentMessage: string;
|
|
5425
5420
|
from: string;
|
|
5426
5421
|
to: string;
|
|
@@ -5482,6 +5477,14 @@ export declare const coreTranslations: {
|
|
|
5482
5477
|
searchItemType: string;
|
|
5483
5478
|
submit: string;
|
|
5484
5479
|
toast: {
|
|
5480
|
+
/**
|
|
5481
|
+
* Hook to create I18n object.
|
|
5482
|
+
* @param {UseI18n} props - The I18n configuration.
|
|
5483
|
+
* @param {string} props.locale - The locale to use.
|
|
5484
|
+
* @param {Record<string, string>} props.translations - The translations to use.
|
|
5485
|
+
* @param {boolean} props.enableCDN - Whether to pull core-react translations from the CDN or not, by default it follows the value passed down through the parent I18nProvider.
|
|
5486
|
+
* @returns {I18nWithCDNFlag} The I18n object.
|
|
5487
|
+
*/
|
|
5485
5488
|
itemAdded: string;
|
|
5486
5489
|
itemAdditionFailed: string;
|
|
5487
5490
|
itemRemoved: string;
|
|
@@ -5795,7 +5798,11 @@ export declare const coreTranslations: {
|
|
|
5795
5798
|
recipientSelectPlaceholder: string;
|
|
5796
5799
|
emailRecipientRequiredError: string;
|
|
5797
5800
|
emailSubjectRequiredError: string;
|
|
5798
|
-
goToAllEmails: string;
|
|
5801
|
+
goToAllEmails: string; /**
|
|
5802
|
+
* @deprecated this type will no longer be supported from core-i18n-js,
|
|
5803
|
+
* to have a type safe Locale use TmsSupportedLocale or AllLocales from [Globalization toolkit](https://github.com/procore/globalization-toolkit)
|
|
5804
|
+
* @deprecatedSince 12.10.0
|
|
5805
|
+
*/
|
|
5799
5806
|
sendEmail: string;
|
|
5800
5807
|
replyAll: string;
|
|
5801
5808
|
downloadAll: string;
|
|
@@ -6190,6 +6197,11 @@ export declare const coreTranslations: {
|
|
|
6190
6197
|
cc: string;
|
|
6191
6198
|
bcc: string;
|
|
6192
6199
|
downloadPdfLong: string;
|
|
6200
|
+
/**
|
|
6201
|
+
* @deprecated this type will no longer be supported from core-i18n-js,
|
|
6202
|
+
* to have a type safe Locale use TmsSupportedLocale or AllLocales from [Globalization toolkit](https://github.com/procore/globalization-toolkit)
|
|
6203
|
+
* @deprecatedSince 12.10.0
|
|
6204
|
+
*/
|
|
6193
6205
|
downloadPdfShort: string;
|
|
6194
6206
|
privateEmailDisclaimer: string;
|
|
6195
6207
|
privateLabel: string;
|
|
@@ -6623,15 +6635,7 @@ export declare const coreTranslations: {
|
|
|
6623
6635
|
};
|
|
6624
6636
|
panelTitle: string;
|
|
6625
6637
|
search: string;
|
|
6626
|
-
searchItemType: string;
|
|
6627
|
-
* Provider to wrap the application with the I18n context.
|
|
6628
|
-
* @param {PropsWithChildren<UseI18n>} props - The I18n configuration.
|
|
6629
|
-
* @param {React.ReactNode} props.children - The children to render.
|
|
6630
|
-
* @param {UseI18n} props.locale - The locale to use.
|
|
6631
|
-
* @param {Record<string, string>} props.translations - The translations to use.
|
|
6632
|
-
* @param {boolean} props.enableCDN - Whether to pull core-react translations from the CDN or not, by default it follows the value passed down through the parent I18nProvider.
|
|
6633
|
-
* @returns {React.ReactNode} The I18n context instance.
|
|
6634
|
-
*/
|
|
6638
|
+
searchItemType: string;
|
|
6635
6639
|
submit: string;
|
|
6636
6640
|
toast: {
|
|
6637
6641
|
itemAdded: string;
|
package/dist/_hooks/I18n.js
CHANGED
|
@@ -39,6 +39,8 @@ import zhSG from '../_locales/zh-SG.json';
|
|
|
39
39
|
import zhTW from '../_locales/zh-TW.json';
|
|
40
40
|
import { OVERWRITE_LOCALE_MAP } from './getI18nProviderLocale';
|
|
41
41
|
|
|
42
|
+
// Incase of error, Make sure I18njsConfig['locale'] has the same locales as Locale
|
|
43
|
+
|
|
42
44
|
/**
|
|
43
45
|
* @deprecated this type will no longer be supported from core-i18n-js,
|
|
44
46
|
* to have a type safe Locale use TmsSupportedLocale or AllLocales from [Globalization toolkit](https://github.com/procore/globalization-toolkit)
|
package/dist/_hooks/I18n.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"I18n.js","names":["getFallbackList","isCDNFeatureFlagEnabled","useRequestTranslations","createI18njs","R","React","deDE","enAU","enCA","enGB","en","esES","es","frCA","frFR","isIS","itIT","jaJP","nbNO","plPL","pseudo","ptBR","ptPT","thTH","zhSG","zhTW","OVERWRITE_LOCALE_MAP","coreTranslations","FALLBACK_LOCALE_MAP","_objectSpread","getTranslationFallbacks","locale","setTranslationFallbacks","I18n","isCDNEnabled","locales","fallbacks","filter","concat","_toConsumableArray","useI18n","_ref","_ref$translations","translations","_translations","enableCDN","i18nContext","useContext","I18nContext","coreCDNTranslations","type","absolute_file_path","oldTranslations","mergeDeepLeft","I18nWithFallbacks","createContext","I18nProvider","_ref2","children","props","_objectWithoutProperties","_excluded","createElement","Provider","value","useI18nContext","ctx"],"sources":["../../src/_hooks/I18n.tsx"],"sourcesContent":["import {\n getFallbackList,\n isCDNFeatureFlagEnabled,\n useRequestTranslations,\n} from '@procore/cdn-translations'\nimport type { I18njs, I18njsConfig } from '@procore/core-i18n-js'\nimport { createI18njs } from '@procore/core-i18n-js'\nimport * as R from 'ramda'\nimport React, { type PropsWithChildren } from 'react'\nimport deDE from '../_locales/de-DE.json'\nimport enAU from '../_locales/en-AU.json'\nimport enCA from '../_locales/en-CA.json'\nimport enGB from '../_locales/en-GB.json'\nimport en from '../_locales/en.json'\nimport esES from '../_locales/es-ES.json'\nimport es from '../_locales/es.json'\nimport frCA from '../_locales/fr-CA.json'\nimport frFR from '../_locales/fr-FR.json'\nimport isIS from '../_locales/is-IS.json'\nimport itIT from '../_locales/it-IT.json'\nimport jaJP from '../_locales/ja-JP.json'\nimport nbNO from '../_locales/nb-NO.json'\nimport plPL from '../_locales/pl-PL.json'\nimport pseudo from '../_locales/pseudo.json'\nimport ptBR from '../_locales/pt-BR.json'\nimport ptPT from '../_locales/pt-PT.json'\nimport thTH from '../_locales/th-TH.json'\nimport zhSG from '../_locales/zh-SG.json'\nimport zhTW from '../_locales/zh-TW.json'\nimport { OVERWRITE_LOCALE_MAP } from './getI18nProviderLocale'\n\ntype I18nConfig = Omit<I18njsConfig, 'I18n'>\n\ntype I18nWithCDNFlag = I18njs & {\n enableCDN?: boolean\n}\n\n/**\n * @deprecated this type will no longer be supported from core-i18n-js,\n * to have a type safe Locale use TmsSupportedLocale or AllLocales from [Globalization toolkit](https://github.com/procore/globalization-toolkit)\n * @deprecatedSince 12.10.0\n */\nexport type Locale =\n | 'de-DE'\n | 'en-AE'\n | 'en-AU'\n | 'en-CA'\n | 'en-GB'\n | 'en-SG'\n | 'en'\n | 'es-ES'\n | 'es'\n | 'fr-CA'\n | 'fr-FR'\n | 'is-IS'\n | 'ja-JP'\n | 'pt-BR'\n | 'th-TH'\n | 'zh-SG'\n | 'pseudo'\n | 'pl-PL'\n | 'nb-NO'\n | 'zh-TW'\n | 'it-IT'\n | 'pt-PT'\n\n/* Set up core translations */\nexport const coreTranslations = {\n 'de-DE': deDE,\n en,\n 'en-AU': enAU,\n 'en-CA': enCA,\n 'en-GB': enGB,\n es,\n 'es-ES': esES,\n 'fr-CA': frCA,\n 'fr-FR': frFR,\n 'is-IS': isIS,\n 'ja-JP': jaJP,\n pseudo,\n 'pt-BR': ptBR,\n 'th-TH': thTH,\n 'zh-SG': zhSG,\n 'pl-PL': plPL,\n 'nb-NO': nbNO,\n 'zh-TW': zhTW,\n 'it-IT': itIT,\n 'pt-PT': ptPT,\n} as const\n\nconst FALLBACK_LOCALE_MAP: Record<string, Locale> = {\n 'es-ES': 'es',\n 'fr-FR': 'fr-CA',\n ...OVERWRITE_LOCALE_MAP,\n}\n\nfunction getTranslationFallbacks(locale: string): Locale[] {\n if (FALLBACK_LOCALE_MAP[locale]) {\n return [FALLBACK_LOCALE_MAP[locale], 'en']\n }\n\n return ['en']\n}\n\nfunction setTranslationFallbacks(\n I18n: I18nWithCDNFlag,\n isCDNEnabled: boolean | undefined\n) {\n if (isCDNEnabled === true) {\n I18n.locales[I18n.locale] = function () {\n return getFallbackList(I18n.locale)\n }\n } else {\n I18n.locales[I18n.locale] = function () {\n const fallbacks = getTranslationFallbacks(I18n.locale).filter(\n (locale) => locale !== I18n.locale\n )\n return [I18n.locale, ...fallbacks]\n }\n }\n\n return I18n\n}\n\ntype UseI18n = I18nConfig & {\n enableCDN?: boolean\n}\n\n/**\n * Hook to create I18n object.\n * @param {UseI18n} props - The I18n configuration.\n * @param {string} props.locale - The locale to use.\n * @param {Record<string, string>} props.translations - The translations to use.\n * @param {boolean} props.enableCDN - Whether to pull core-react translations from the CDN or not, by default it follows the value passed down through the parent I18nProvider.\n * @returns {I18nWithCDNFlag} The I18n object.\n */\nexport function useI18n({\n locale,\n translations: _translations = {},\n enableCDN,\n}: UseI18n): I18nWithCDNFlag {\n const i18nContext: I18nWithCDNFlag | undefined = React.useContext(I18nContext)\n\n const isCDNEnabled = isCDNFeatureFlagEnabled(i18nContext, enableCDN)\n\n const coreCDNTranslations = useRequestTranslations(\n {\n locale: locale ?? 'en',\n type: 'file',\n absolute_file_path: (locale) =>\n `core/packages/core-react/src/_locales/${locale}.json`,\n },\n { en, pseudo },\n {\n oldTranslations: coreTranslations,\n enableCDN: isCDNEnabled,\n }\n )\n\n const translations = R.mergeDeepLeft(\n _translations,\n coreCDNTranslations.translations\n )\n\n const I18n = createI18njs({\n locale,\n translations,\n })\n\n const I18nWithFallbacks = setTranslationFallbacks(I18n, isCDNEnabled)\n\n I18nWithFallbacks.enableCDN = isCDNEnabled\n\n return I18nWithFallbacks\n}\n\nexport const I18nContext: React.Context<I18nWithCDNFlag> = React.createContext(\n createI18njs({\n locale: 'en',\n translations: { en: coreTranslations.en },\n })\n)\n\n/**\n * Provider to wrap the application with the I18n context.\n * @param {PropsWithChildren<UseI18n>} props - The I18n configuration.\n * @param {React.ReactNode} props.children - The children to render.\n * @param {UseI18n} props.locale - The locale to use.\n * @param {Record<string, string>} props.translations - The translations to use.\n * @param {boolean} props.enableCDN - Whether to pull core-react translations from the CDN or not, by default it follows the value passed down through the parent I18nProvider.\n * @returns {React.ReactNode} The I18n context instance.\n */\nexport function I18nProvider({\n children,\n ...props\n}: PropsWithChildren<UseI18n>) {\n return (\n <I18nContext.Provider value={useI18n(props)}>\n {children}\n </I18nContext.Provider>\n )\n}\n\n// Base type of user provider translations type\ntype DeepStringRecord = {\n [key: string]: string | DeepStringRecord\n}\n\ntype PluralizationForm = {\n zero?: string\n one: string\n other: string\n}\n\n// Type to get nested key paths with dot notation\ntype DotPrefix<T extends string> = T extends '' ? '' : `.${T}`\ntype DotNestedKeys<T> = (\n T extends string\n ? ''\n : T extends DeepStringRecord\n ? {\n [K in keyof T]: K extends string\n ? T[K] extends PluralizationForm\n ? `${K}`\n : T[K] extends DeepStringRecord\n ? `${K}${DotPrefix<DotNestedKeys<T[K]>>}`\n : `${K}`\n : never\n }[keyof T]\n : ''\n) extends infer D\n ? Extract<D, string>\n : never\n\n// Type to get the literal string type from a path\ntype StringLiteralPathValue<\n T,\n P extends string\n> = P extends `${infer K}.${infer Rest}`\n ? K extends keyof T\n ? T[K] extends PluralizationForm\n ? T[K]\n : T[K] extends DeepStringRecord\n ? StringLiteralPathValue<T[K], Rest>\n : never\n : never\n : P extends keyof T\n ? T[P] extends PluralizationForm\n ? T[P]\n : T[P] extends string\n ? T[P]\n : never\n : never\n\n// Check if a string has any interpolation variables\ntype HasInterpolation<T extends string> =\n T extends `${string}%{${string}}${string}` ? true : false\n\n// Extract interpolation variables from a string\ntype ExtractInterpolationVars<T extends string> =\n T extends `${infer _Before}%{${infer Param}}${infer After}`\n ? Param | ExtractInterpolationVars<After>\n : never\n\n// always allowed values in the interpolation object (remove [key: string]: any in favor of our strong types)\ntype ExplicitTranslateOptions = {\n [K in keyof I18n.TranslateOptions as string extends K\n ? never\n : K]: I18n.TranslateOptions[K]\n}\n\ntype InterpolationParams<T extends string> = HasInterpolation<T> extends true\n ? {\n [K in ExtractInterpolationVars<T>]: string\n } & {\n [K in keyof ExplicitTranslateOptions]?: ExplicitTranslateOptions[K]\n }\n : never\n\ntype PluralizationParams<T extends PluralizationForm> = {\n count: number\n} & (\n | (T['zero'] extends string\n ? { count: 0 } & { [K in ExtractInterpolationVars<T['zero']>]: string }\n : {})\n | (T['one'] extends string\n ? { count: 1 } & { [K in ExtractInterpolationVars<T['one']>]: string }\n : {})\n | (T['other'] extends string\n ? { count: number } & {\n [K in ExtractInterpolationVars<T['other']>]: string\n }\n : {})\n) & {\n [K in keyof ExplicitTranslateOptions]?: ExplicitTranslateOptions[K]\n }\n\ntype InterpolationOrPluralizationParams<T> = T extends PluralizationForm\n ? [PluralizationParams<T>]\n : T extends string\n ? InterpolationParams<T> extends never\n ? [ExplicitTranslateOptions?]\n : [InterpolationParams<T>]\n : [ExplicitTranslateOptions?]\n\ntype TypedTranslate<Translations> = <P extends DotNestedKeys<Translations>>(\n path: P,\n ...args: InterpolationOrPluralizationParams<\n StringLiteralPathValue<Translations, P>\n >\n) => StringLiteralPathValue<Translations, P>\n\ntype I18njsWithTypedTranslate<Translations> = Omit<\n I18nWithCDNFlag,\n 't' | 'translate'\n> & {\n t: TypedTranslate<Translations>\n translate: TypedTranslate<Translations>\n}\n\nexport function useI18nContext<\n Translations extends DeepStringRecord | undefined = undefined\n>(): Translations extends undefined\n ? I18nWithCDNFlag\n : I18njsWithTypedTranslate<NonNullable<Translations>>\n// overload for when no generic is provided\nexport function useI18nContext(): I18nWithCDNFlag\n\n/**\n * Hook to access the I18n context.\n *\n * @template Translations - An optional generic to provide type safety for translations.\n * If specified, it enables typed access to the `t` and `translate` methods of the I18n instance.\n * These methods will have type safe access to both the tranlsation scope as well as the interpolation variables.\n * If not specified, the default I18nWithCDN instance is returned.\n *\n * @returns {I18nWithCDNFlag | I18njsWithTypedTranslate<Translations>} The I18n context instance,\n * either with or without typed translations based on the provided generic.\n */\nexport function useI18nContext<\n Translations extends DeepStringRecord | undefined = undefined\n>() {\n const ctx = React.useContext(I18nContext)\n\n if (!ctx) {\n // TODO investigate a way to do warnings that won't annoy people\n // we probably need to introduce a build system to have nice dev warnings\n // console.warn()\n }\n\n // Cast to typing if user has provided a type\n return ctx as Translations extends undefined\n ? I18nWithCDNFlag\n : I18njsWithTypedTranslate<NonNullable<Translations>>\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA,SACEA,eAAe,EACfC,uBAAuB,EACvBC,sBAAsB,QACjB,2BAA2B;AAElC,SAASC,YAAY,QAAQ,uBAAuB;AACpD,OAAO,KAAKC,CAAC,MAAM,OAAO;AAC1B,OAAOC,KAAK,MAAkC,OAAO;AACrD,OAAOC,IA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AAO,CAACmB,KAAK;EAAE,GACzCD,QACmB,CAAC;AAE3B;;AAEA;;AAWA;;AAoBA;;AAoBA;;AAIA;;AAMA;;AA6DA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASO,cAAcA,CAAA,EAE1B;EACF,IAAMC,GAAG,GAAG7D,KAAK,CAAC0C,UAAU,CAACC,WAAW,CAAC;EAEzC,IAAI,CAACkB,GAAG,EAAE;IACR;IACA;IACA;EAAA;;EAGF;EACA,OAAOA,GAAG;AAGZ"}
|
|
1
|
+
{"version":3,"file":"I18n.js","names":["getFallbackList","isCDNFeatureFlagEnabled","useRequestTranslations","createI18njs","R","React","deDE","enAU","enCA","enGB","en","esES","es","frCA","frFR","isIS","itIT","jaJP","nbNO","plPL","pseudo","ptBR","ptPT","thTH","zhSG","zhTW","OVERWRITE_LOCALE_MAP","coreTranslations","FALLBACK_LOCALE_MAP","_objectSpread","getTranslationFallbacks","locale","setTranslationFallbacks","I18n","isCDNEnabled","locales","fallbacks","filter","concat","_toConsumableArray","useI18n","_ref","_ref$translations","translations","_translations","enableCDN","i18nContext","useContext","I18nContext","coreCDNTranslations","type","absolute_file_path","oldTranslations","mergeDeepLeft","I18nWithFallbacks","createContext","I18nProvider","_ref2","children","props","_objectWithoutProperties","_excluded","createElement","Provider","value","useI18nContext","ctx"],"sources":["../../src/_hooks/I18n.tsx"],"sourcesContent":["import {\n getFallbackList,\n isCDNFeatureFlagEnabled,\n useRequestTranslations,\n} from '@procore/cdn-translations'\nimport type { I18njs, I18njsConfig } from '@procore/core-i18n-js'\nimport { createI18njs } from '@procore/core-i18n-js'\nimport * as R from 'ramda'\nimport React, { type PropsWithChildren } from 'react'\nimport deDE from '../_locales/de-DE.json'\nimport enAU from '../_locales/en-AU.json'\nimport enCA from '../_locales/en-CA.json'\nimport enGB from '../_locales/en-GB.json'\nimport en from '../_locales/en.json'\nimport esES from '../_locales/es-ES.json'\nimport es from '../_locales/es.json'\nimport frCA from '../_locales/fr-CA.json'\nimport frFR from '../_locales/fr-FR.json'\nimport isIS from '../_locales/is-IS.json'\nimport itIT from '../_locales/it-IT.json'\nimport jaJP from '../_locales/ja-JP.json'\nimport nbNO from '../_locales/nb-NO.json'\nimport plPL from '../_locales/pl-PL.json'\nimport pseudo from '../_locales/pseudo.json'\nimport ptBR from '../_locales/pt-BR.json'\nimport ptPT from '../_locales/pt-PT.json'\nimport thTH from '../_locales/th-TH.json'\nimport zhSG from '../_locales/zh-SG.json'\nimport zhTW from '../_locales/zh-TW.json'\nimport { OVERWRITE_LOCALE_MAP } from './getI18nProviderLocale'\n\ntype AssertExtends<T, U extends T> = U\n\n// Incase of error, Make sure I18njsConfig['locale'] has the same locales as Locale\ntype _ = AssertExtends<I18njsConfig['locale'], Locale>\n\ntype I18nConfig = Omit<I18njsConfig, 'I18n'>\n\ntype I18nWithCDNFlag = I18njs & {\n enableCDN?: boolean\n}\n\n/**\n * @deprecated this type will no longer be supported from core-i18n-js,\n * to have a type safe Locale use TmsSupportedLocale or AllLocales from [Globalization toolkit](https://github.com/procore/globalization-toolkit)\n * @deprecatedSince 12.10.0\n */\nexport type Locale =\n | 'de-DE'\n | 'en-AE'\n | 'en-AU'\n | 'en-CA'\n | 'en-GB'\n | 'en-SG'\n | 'en'\n | 'es-ES'\n | 'es'\n | 'fr-CA'\n | 'fr-FR'\n | 'is-IS'\n | 'ja-JP'\n | 'pt-BR'\n | 'th-TH'\n | 'zh-SG'\n | 'pseudo'\n | 'pl-PL'\n | 'nb-NO'\n | 'zh-TW'\n | 'it-IT'\n | 'pt-PT'\n\n/* Set up core translations */\nexport const coreTranslations = {\n 'de-DE': deDE,\n en,\n 'en-AU': enAU,\n 'en-CA': enCA,\n 'en-GB': enGB,\n es,\n 'es-ES': esES,\n 'fr-CA': frCA,\n 'fr-FR': frFR,\n 'is-IS': isIS,\n 'ja-JP': jaJP,\n pseudo,\n 'pt-BR': ptBR,\n 'th-TH': thTH,\n 'zh-SG': zhSG,\n 'pl-PL': plPL,\n 'nb-NO': nbNO,\n 'zh-TW': zhTW,\n 'it-IT': itIT,\n 'pt-PT': ptPT,\n} as const\n\nconst FALLBACK_LOCALE_MAP: Record<string, Locale> = {\n 'es-ES': 'es',\n 'fr-FR': 'fr-CA',\n ...OVERWRITE_LOCALE_MAP,\n}\n\nfunction getTranslationFallbacks(locale: string): Locale[] {\n if (FALLBACK_LOCALE_MAP[locale]) {\n return [FALLBACK_LOCALE_MAP[locale], 'en']\n }\n\n return ['en']\n}\n\nfunction setTranslationFallbacks(\n I18n: I18nWithCDNFlag,\n isCDNEnabled: boolean | undefined\n) {\n if (isCDNEnabled === true) {\n I18n.locales[I18n.locale] = function () {\n return getFallbackList(I18n.locale)\n }\n } else {\n I18n.locales[I18n.locale] = function () {\n const fallbacks = getTranslationFallbacks(I18n.locale).filter(\n (locale) => locale !== I18n.locale\n )\n return [I18n.locale, ...fallbacks]\n }\n }\n\n return I18n\n}\n\ntype UseI18n = I18nConfig & {\n enableCDN?: boolean\n}\n\n/**\n * Hook to create I18n object.\n * @param {UseI18n} props - The I18n configuration.\n * @param {string} props.locale - The locale to use.\n * @param {Record<string, string>} props.translations - The translations to use.\n * @param {boolean} props.enableCDN - Whether to pull core-react translations from the CDN or not, by default it follows the value passed down through the parent I18nProvider.\n * @returns {I18nWithCDNFlag} The I18n object.\n */\nexport function useI18n({\n locale,\n translations: _translations = {},\n enableCDN,\n}: UseI18n): I18nWithCDNFlag {\n const i18nContext: I18nWithCDNFlag | undefined = React.useContext(I18nContext)\n\n const isCDNEnabled = isCDNFeatureFlagEnabled(i18nContext, enableCDN)\n\n const coreCDNTranslations = useRequestTranslations(\n {\n locale: locale ?? 'en',\n type: 'file',\n absolute_file_path: (locale) =>\n `core/packages/core-react/src/_locales/${locale}.json`,\n },\n { en, pseudo },\n {\n oldTranslations: coreTranslations,\n enableCDN: isCDNEnabled,\n }\n )\n\n const translations = R.mergeDeepLeft(\n _translations,\n coreCDNTranslations.translations\n )\n\n const I18n = createI18njs({\n locale,\n translations,\n })\n\n const I18nWithFallbacks = setTranslationFallbacks(I18n, isCDNEnabled)\n\n I18nWithFallbacks.enableCDN = isCDNEnabled\n\n return I18nWithFallbacks\n}\n\nexport const I18nContext: React.Context<I18nWithCDNFlag> = React.createContext(\n createI18njs({\n locale: 'en',\n translations: { en: coreTranslations.en },\n })\n)\n\n/**\n * Provider to wrap the application with the I18n context.\n * @param {PropsWithChildren<UseI18n>} props - The I18n configuration.\n * @param {React.ReactNode} props.children - The children to render.\n * @param {UseI18n} props.locale - The locale to use.\n * @param {Record<string, string>} props.translations - The translations to use.\n * @param {boolean} props.enableCDN - Whether to pull core-react translations from the CDN or not, by default it follows the value passed down through the parent I18nProvider.\n * @returns {React.ReactNode} The I18n context instance.\n */\nexport function I18nProvider({\n children,\n ...props\n}: PropsWithChildren<UseI18n>) {\n return (\n <I18nContext.Provider value={useI18n(props)}>\n {children}\n </I18nContext.Provider>\n )\n}\n\n// Base type of user provider translations type\ntype DeepStringRecord = {\n [key: string]: string | DeepStringRecord\n}\n\ntype PluralizationForm = {\n zero?: string\n one: string\n other: string\n}\n\n// Type to get nested key paths with dot notation\ntype DotPrefix<T extends string> = T extends '' ? '' : `.${T}`\ntype DotNestedKeys<T> = (\n T extends string\n ? ''\n : T extends DeepStringRecord\n ? {\n [K in keyof T]: K extends string\n ? T[K] extends PluralizationForm\n ? `${K}`\n : T[K] extends DeepStringRecord\n ? `${K}${DotPrefix<DotNestedKeys<T[K]>>}`\n : `${K}`\n : never\n }[keyof T]\n : ''\n) extends infer D\n ? Extract<D, string>\n : never\n\n// Type to get the literal string type from a path\ntype StringLiteralPathValue<\n T,\n P extends string\n> = P extends `${infer K}.${infer Rest}`\n ? K extends keyof T\n ? T[K] extends PluralizationForm\n ? T[K]\n : T[K] extends DeepStringRecord\n ? StringLiteralPathValue<T[K], Rest>\n : never\n : never\n : P extends keyof T\n ? T[P] extends PluralizationForm\n ? T[P]\n : T[P] extends string\n ? T[P]\n : never\n : never\n\n// Check if a string has any interpolation variables\ntype HasInterpolation<T extends string> =\n T extends `${string}%{${string}}${string}` ? true : false\n\n// Extract interpolation variables from a string\ntype ExtractInterpolationVars<T extends string> =\n T extends `${infer _Before}%{${infer Param}}${infer After}`\n ? Param | ExtractInterpolationVars<After>\n : never\n\n// always allowed values in the interpolation object (remove [key: string]: any in favor of our strong types)\ntype ExplicitTranslateOptions = {\n [K in keyof I18n.TranslateOptions as string extends K\n ? never\n : K]: I18n.TranslateOptions[K]\n}\n\ntype InterpolationParams<T extends string> = HasInterpolation<T> extends true\n ? {\n [K in ExtractInterpolationVars<T>]: string\n } & {\n [K in keyof ExplicitTranslateOptions]?: ExplicitTranslateOptions[K]\n }\n : never\n\ntype PluralizationParams<T extends PluralizationForm> = {\n count: number\n} & (\n | (T['zero'] extends string\n ? { count: 0 } & { [K in ExtractInterpolationVars<T['zero']>]: string }\n : {})\n | (T['one'] extends string\n ? { count: 1 } & { [K in ExtractInterpolationVars<T['one']>]: string }\n : {})\n | (T['other'] extends string\n ? { count: number } & {\n [K in ExtractInterpolationVars<T['other']>]: string\n }\n : {})\n) & {\n [K in keyof ExplicitTranslateOptions]?: ExplicitTranslateOptions[K]\n }\n\ntype InterpolationOrPluralizationParams<T> = T extends PluralizationForm\n ? [PluralizationParams<T>]\n : T extends string\n ? InterpolationParams<T> extends never\n ? [ExplicitTranslateOptions?]\n : [InterpolationParams<T>]\n : [ExplicitTranslateOptions?]\n\ntype TypedTranslate<Translations> = <P extends DotNestedKeys<Translations>>(\n path: P,\n ...args: InterpolationOrPluralizationParams<\n StringLiteralPathValue<Translations, P>\n >\n) => StringLiteralPathValue<Translations, P>\n\ntype I18njsWithTypedTranslate<Translations> = Omit<\n I18nWithCDNFlag,\n 't' | 'translate'\n> & {\n t: TypedTranslate<Translations>\n translate: TypedTranslate<Translations>\n}\n\nexport function useI18nContext<\n Translations extends DeepStringRecord | undefined = undefined\n>(): Translations extends undefined\n ? I18nWithCDNFlag\n : I18njsWithTypedTranslate<NonNullable<Translations>>\n// overload for when no generic is provided\nexport function useI18nContext(): I18nWithCDNFlag\n\n/**\n * Hook to access the I18n context.\n *\n * @template Translations - An optional generic to provide type safety for translations.\n * If specified, it enables typed access to the `t` and `translate` methods of the I18n instance.\n * These methods will have type safe access to both the tranlsation scope as well as the interpolation variables.\n * If not specified, the default I18nWithCDN instance is returned.\n *\n * @returns {I18nWithCDNFlag | I18njsWithTypedTranslate<Translations>} The I18n context instance,\n * either with or without typed translations based on the provided generic.\n */\nexport function useI18nContext<\n Translations extends DeepStringRecord | undefined = undefined\n>() {\n const ctx = React.useContext(I18nContext)\n\n if (!ctx) {\n // TODO investigate a way to do warnings that won't annoy people\n // we probably need to introduce a build system to have nice dev warnings\n // console.warn()\n }\n\n // Cast to typing if user has provided a type\n return ctx as Translations extends undefined\n ? I18nWithCDNFlag\n : I18njsWithTypedTranslate<NonNullable<Translations>>\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA,SACEA,eAAe,EACfC,uBAAuB,EACvBC,sBAAsB,QACjB,2BAA2B;AAElC,SAASC,YAAY,QAAQ,uBAAuB;AACpD,OAAO,KAAKC,CAAC,MAAM,OAAO;AAC1B,OAAOC,KAAK,MAAkC,OAAO;AACrD,OAAOC,IAAI,MAAM,wBAAwB;AACzC,OAAOC,IAAI,MAAM,wBAAwB;AACzC,OAAOC,IAAI,MAAM,wBAAwB;AACzC,OAAOC,IAAI,MAAM,wBAAwB;AACzC,OAAOC,EAAE,MAAM,qBAAqB;AACpC,OAAOC,IAAI,MAAM,wBAAwB;AACzC,OAAOC,EAAE,MAAM,qBAAqB;AACpC,OAAOC,IAAI,MAAM,wBAAwB;AACzC,OAAOC,IAAI,MAAM,wBAAwB;AACzC,OAAOC,IAAI,MAAM,wBAAwB;AACzC,OAAOC,IAAI,MAAM,wBAAwB;AACzC,OAAOC,IAAI,MAAM,wBAAwB;AACzC,OAAOC,IAAI,MAAM,wBAAwB;AACzC,OAAOC,IAAI,MAAM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aking change requiring a new minimum version of the peerDep, replace with GTK imports
|
|
7
|
-
var SUPPORTED_LOCALES = ['de-DE', 'en-AU', 'en-CA', 'en-GB', 'en', 'es-ES', 'es', 'fr-CA', 'fr-FR', 'is-IS', 'ja-JP', 'pl-PL', 'pseudo', 'pt-BR', 'th-TH', 'zh-SG'];
|
|
7
|
+
var SUPPORTED_LOCALES = ['de-DE', 'en-AU', 'en-CA', 'en-GB', 'en', 'es-ES', 'es', 'fr-CA', 'fr-FR', 'is-IS', 'ja-JP', 'pl-PL', 'pseudo', 'pt-BR', 'th-TH', 'zh-SG', 'zh-TW', 'it-IT', 'pt-PT', 'nb-NO'];
|
|
8
8
|
/*
|
|
9
9
|
all locales that should directly use a different locale. Any other unsupported locale will fallback to 'en'
|
|
10
10
|
this should match https://github.com/procore/procore/blob/d0515461046b8d018c8fa8ede1ca8b7aa2fcacf8/config/application.rb#L234C1-L240C7
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getI18nProviderLocale.js","names":["SUPPORTED_LOCALES","OVERWRITE_LOCALE_MAP","getI18nProviderLocale","envLocale","includes"],"sources":["../../src/_hooks/getI18nProviderLocale.ts"],"sourcesContent":["import type { Locale } from './I18n'\n\n// All and only locales that will receive Smartling translations and can be directly fed into <I18nProvider>\n/**\n * @deprecated you can use TMS_SUPPORTED_LOCALE from [Globalization toolkit](https://github.com/procore/globalization-toolkit)\n * @deprecatedSince 12.10.0\n */\n// TODO breaking change requiring a new minimum version of the peerDep, replace with GTK imports\nconst SUPPORTED_LOCALES: Locale[] = [\n 'de-DE',\n 'en-AU',\n 'en-CA',\n 'en-GB',\n 'en',\n 'es-ES',\n 'es',\n 'fr-CA',\n 'fr-FR',\n 'is-IS',\n 'ja-JP',\n 'pl-PL',\n 'pseudo',\n 'pt-BR',\n 'th-TH',\n 'zh-SG',\n]\n/*\n all locales that should directly use a different locale. Any other unsupported locale will fallback to 'en'\n this should match https://github.com/procore/procore/blob/d0515461046b8d018c8fa8ede1ca8b7aa2fcacf8/config/application.rb#L234C1-L240C7\n for any locales that are not listed in SUPPORTED_LOCALES\n*/\n/**\n * @deprecated you can use OVERWRITE_LOCALE_MAP from [Globalization toolkit](https://github.com/procore/globalization-toolkit)\n * @deprecatedSince 12.10.0\n */\nexport const OVERWRITE_LOCALE_MAP: Record<string, Locale> = {\n 'en-AE': 'en-GB',\n 'en-SG': 'en-GB',\n 'es-419': 'es',\n} as const\n\n/**\n * @deprecatedSince 12.10.0\n * @deprecated you can use getOverrideLocale from [Globalization toolkit](https://procore.github.io/globalization-toolkit/#md:getoverridelocale-function)\n * Returns the locale that should be used for the I18nProvider based on the environment locale\n * @param envLocale - the locale from the environment\n * @returns the locale that should be used for the I18nProvider\n */\nexport function getI18nProviderLocale(envLocale: string): Locale {\n if (SUPPORTED_LOCALES.includes(envLocale as Locale)) {\n return envLocale as Locale\n }\n if (OVERWRITE_LOCALE_MAP[envLocale]) {\n return OVERWRITE_LOCALE_MAP[envLocale]\n }\n\n return 'en'\n}\n"],"mappings":"AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMA,iBAA2B,GAAG,CAClC,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,QAAQ,EACR,OAAO,EACP,OAAO,EACP,OAAO,CACR;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,oBAA4C,GAAG;EAC1D,OAAO,EAAE,OAAO;EAChB,OAAO,EAAE,OAAO;EAChB,QAAQ,EAAE;AACZ,CAAU;;AAEV;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,qBAAqBA,CAACC,SAAiB,EAAU;EAC/D,IAAIH,iBAAiB,CAACI,QAAQ,CAACD,SAAmB,CAAC,EAAE;IACnD,OAAOA,SAAS;EAClB;EACA,IAAIF,oBAAoB,CAACE,SAAS,CAAC,EAAE;IACnC,OAAOF,oBAAoB,CAACE,SAAS,CAAC;EACxC;EAEA,OAAO,IAAI;AACb"}
|
|
1
|
+
{"version":3,"file":"getI18nProviderLocale.js","names":["SUPPORTED_LOCALES","OVERWRITE_LOCALE_MAP","getI18nProviderLocale","envLocale","includes"],"sources":["../../src/_hooks/getI18nProviderLocale.ts"],"sourcesContent":["import type { Locale } from './I18n'\n\n// All and only locales that will receive Smartling translations and can be directly fed into <I18nProvider>\n/**\n * @deprecated you can use TMS_SUPPORTED_LOCALE from [Globalization toolkit](https://github.com/procore/globalization-toolkit)\n * @deprecatedSince 12.10.0\n */\n// TODO breaking change requiring a new minimum version of the peerDep, replace with GTK imports\nconst SUPPORTED_LOCALES: Locale[] = [\n 'de-DE',\n 'en-AU',\n 'en-CA',\n 'en-GB',\n 'en',\n 'es-ES',\n 'es',\n 'fr-CA',\n 'fr-FR',\n 'is-IS',\n 'ja-JP',\n 'pl-PL',\n 'pseudo',\n 'pt-BR',\n 'th-TH',\n 'zh-SG',\n 'zh-TW',\n 'it-IT',\n 'pt-PT',\n 'nb-NO',\n]\n/*\n all locales that should directly use a different locale. Any other unsupported locale will fallback to 'en'\n this should match https://github.com/procore/procore/blob/d0515461046b8d018c8fa8ede1ca8b7aa2fcacf8/config/application.rb#L234C1-L240C7\n for any locales that are not listed in SUPPORTED_LOCALES\n*/\n/**\n * @deprecated you can use OVERWRITE_LOCALE_MAP from [Globalization toolkit](https://github.com/procore/globalization-toolkit)\n * @deprecatedSince 12.10.0\n */\nexport const OVERWRITE_LOCALE_MAP: Record<string, Locale> = {\n 'en-AE': 'en-GB',\n 'en-SG': 'en-GB',\n 'es-419': 'es',\n} as const\n\n/**\n * @deprecatedSince 12.10.0\n * @deprecated you can use getOverrideLocale from [Globalization toolkit](https://procore.github.io/globalization-toolkit/#md:getoverridelocale-function)\n * Returns the locale that should be used for the I18nProvider based on the environment locale\n * @param envLocale - the locale from the environment\n * @returns the locale that should be used for the I18nProvider\n */\nexport function getI18nProviderLocale(envLocale: string): Locale {\n if (SUPPORTED_LOCALES.includes(envLocale as Locale)) {\n return envLocale as Locale\n }\n if (OVERWRITE_LOCALE_MAP[envLocale]) {\n return OVERWRITE_LOCALE_MAP[envLocale]\n }\n\n return 'en'\n}\n"],"mappings":"AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMA,iBAA2B,GAAG,CAClC,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,QAAQ,EACR,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,CACR;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,oBAA4C,GAAG;EAC1D,OAAO,EAAE,OAAO;EAChB,OAAO,EAAE,OAAO;EAChB,QAAQ,EAAE;AACZ,CAAU;;AAEV;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,qBAAqBA,CAACC,SAAiB,EAAU;EAC/D,IAAIH,iBAAiB,CAACI,QAAQ,CAACD,SAAmB,CAAC,EAAE;IACnD,OAAOA,SAAS;EAClB;EACA,IAAIF,oBAAoB,CAACE,SAAS,CAAC,EAAE;IACnC,OAAOF,oBAAoB,CAACE,SAAS,CAAC;EACxC;EAEA,OAAO,IAAI;AACb"}
|
package/dist/_locales/de-DE.json
CHANGED
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"itemAdded" : "Das verknüpfte Element wurde erfolgreich verlinkt.",
|
|
106
106
|
"itemAdditionFailed" : "Leider konnte das Element nicht angehängt werden. Bitte versuchen Sie es erneut.",
|
|
107
107
|
"itemRemoved" : "Das verlinkte Element wurde erfolgreich entfernt.",
|
|
108
|
-
"requestError" : "
|
|
108
|
+
"requestError" : "Entschuldigung, da ist etwas schief gelaufen. Bitte versuchen Sie es erneut."
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
},
|
|
@@ -378,4 +378,4 @@
|
|
|
378
378
|
}
|
|
379
379
|
}
|
|
380
380
|
}
|
|
381
|
-
}
|
|
381
|
+
}
|
package/dist/_locales/en-AU.json
CHANGED
package/dist/_locales/en-CA.json
CHANGED
package/dist/_locales/en-GB.json
CHANGED
package/dist/_locales/es-ES.json
CHANGED
package/dist/_locales/es.json
CHANGED
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"itemAdded" : "El ítem relacionado se vinculó correctamente.",
|
|
106
106
|
"itemAdditionFailed" : "Lo sentimos, no se pudo adjuntar el ítem. Inténtelo de nuevo.",
|
|
107
107
|
"itemRemoved" : "El ítem relacionado se eliminó correctamente.",
|
|
108
|
-
"requestError" : "Se produjo un error.
|
|
108
|
+
"requestError" : "Se produjo un error. Inténtelo de nuevo."
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
},
|
|
@@ -203,7 +203,7 @@
|
|
|
203
203
|
"standaloneMaxFileSizeError" : "Uno o más de sus archivos exceden el tamaño máximo de archivo de {{sizeInMegabytes}} MB. Intente cargar un archivo más pequeño.",
|
|
204
204
|
"standaloneZeroFileSizeError" : "Uno o más de sus archivos son archivos vacíos (0 bytes) y no se pueden cargar. Intente cargar un archivo más grande.",
|
|
205
205
|
"uploadTotalProgress" : {
|
|
206
|
-
"withFailed" : "Progreso total: {{totalProgress}}%. Cargado {{uploaded}} de {{total}}. Error {{failed}}.",
|
|
206
|
+
"withFailed" : "Progreso total: {{totalProgress}} %. Cargado {{uploaded}} de {{total}}. Error {{failed}}.",
|
|
207
207
|
"withoutFailed" : "Progreso total: {{totalProgress}}%. Cargado {{uploaded}} de {{total}}."
|
|
208
208
|
}
|
|
209
209
|
},
|
|
@@ -378,4 +378,4 @@
|
|
|
378
378
|
}
|
|
379
379
|
}
|
|
380
380
|
}
|
|
381
|
-
}
|
|
381
|
+
}
|
package/dist/_locales/fr-CA.json
CHANGED
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"itemAdded" : "L'item apparenté a été lié avec succès.",
|
|
106
106
|
"itemAdditionFailed" : "Désolé, l'item n'a pas pu être associé. Veuillez réessayer.",
|
|
107
107
|
"itemRemoved" : "L'item apparenté a été supprimé avec succès.",
|
|
108
|
-
"requestError" : "Désolé,
|
|
108
|
+
"requestError" : "Désolé, un problème est survenu. Veuillez réessayer."
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
},
|
|
@@ -378,4 +378,4 @@
|
|
|
378
378
|
}
|
|
379
379
|
}
|
|
380
380
|
}
|
|
381
|
-
}
|
|
381
|
+
}
|
package/dist/_locales/fr-FR.json
CHANGED
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"itemAdded" : "L'élément lié a été lié avec succès.",
|
|
106
106
|
"itemAdditionFailed" : "Désolé, l'élément n'a pas pu être associé. Veuillez réessayer.",
|
|
107
107
|
"itemRemoved" : "L'élément lié a été supprimé avec succès.",
|
|
108
|
-
"requestError" : "Désolé,
|
|
108
|
+
"requestError" : "Désolé, une erreur s'est produite. Veuillez réessayer."
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
},
|
|
@@ -378,4 +378,4 @@
|
|
|
378
378
|
}
|
|
379
379
|
}
|
|
380
380
|
}
|
|
381
|
-
}
|
|
381
|
+
}
|
package/dist/_locales/is-IS.json
CHANGED
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"itemAdded" : "Tengd atriði var tengd.",
|
|
106
106
|
"itemAdditionFailed" : "Því miður var ekki hægt að festa hlutinn. Vinsamlegast reyndu aftur.",
|
|
107
107
|
"itemRemoved" : "Tengd atriði var fjarlægð.",
|
|
108
|
-
"requestError" : "Afsakið, eitthvað fór úrskeiðis. Vinsamlegast
|
|
108
|
+
"requestError" : "Afsakið, eitthvað fór úrskeiðis. Vinsamlegast reynið aftur."
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
},
|
|
@@ -378,4 +378,4 @@
|
|
|
378
378
|
}
|
|
379
379
|
}
|
|
380
380
|
}
|
|
381
|
-
}
|
|
381
|
+
}
|