Skip to content

Commit 492b568

Browse files
committed
Revert "fix: ensure translations for strings are replaced at runtime"
This reverts commit 393ffb9.
1 parent 78bfdf7 commit 492b568

1 file changed

Lines changed: 60 additions & 61 deletions

File tree

src/components/OpenFileDialog/utils.js

Lines changed: 60 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -18,66 +18,65 @@ export const AOTypeMap = {
1818

1919
const NO_TYPE = 'NO_TYPE'
2020

21-
export const getTranslatedString = (type, key) => {
22-
const texts = {
23-
[NO_TYPE]: {
24-
modalTitle: i18n.t('Open'),
25-
loadingText: i18n.t('Loading'),
26-
errorTitle: i18n.t("Couldn't load items"),
27-
errorText: i18n.t(
28-
'There was a problem loading items. Try again or contact your system administrator.'
29-
),
30-
noDataText: i18n.t('No items found. Create a new to get started.'),
31-
noFilteredDataText: i18n.t(
32-
"No items found. Try adjusting your search or filter options to find what you're looking for."
33-
),
34-
newButtonLabel: i18n.t('Create new'),
35-
},
36-
37-
[AO_TYPE_VISUALIZATION]: {
38-
modalTitle: i18n.t('Open a visualization'),
39-
loadingText: i18n.t('Loading visualizations'),
40-
errorTitle: i18n.t("Couldn't load visualizations"),
41-
errorText: i18n.t(
42-
'There was a problem loading visualizations. Try again or contact your system administrator.'
43-
),
44-
noDataText: i18n.t(
45-
'No visualizations found. Click New visualization to get started.'
46-
),
47-
noFilteredDataText: i18n.t(
48-
"No visualizations found. Try adjusting your search or filter options to find what you're looking for."
49-
),
50-
newButtonLabel: i18n.t('New visualization'),
51-
},
52-
[AO_TYPE_MAP]: {
53-
modalTitle: i18n.t('Open a map'),
54-
loadingText: i18n.t('Loading maps'),
55-
errorTitle: i18n.t("Couldn't load maps"),
56-
errorText: i18n.t(
57-
'There was a problem loading maps. Try again or contact your system administrator.'
58-
),
59-
noDataText: i18n.t('No maps found. Click New map to get started.'),
60-
noFilteredDataText: i18n.t(
61-
"No maps found. Try adjusting your search or filter options to find what you're looking for."
62-
),
63-
newButtonLabel: i18n.t('New map'),
64-
},
65-
[AO_TYPE_EVENT_VISUALIZATION]: {
66-
modalTitle: i18n.t('Open a line list'),
67-
loadingText: i18n.t('Loading line lists'),
68-
errorTitle: i18n.t("Couldn't load line lists"),
69-
errorText: i18n.t(
70-
'There was a problem loading line lists. Try again or contact your system administrator.'
71-
),
72-
noDataText: i18n.t(
73-
'No line lists found. Click New line list to get started.'
74-
),
75-
noFilteredDataText: i18n.t(
76-
"No line lists found. Try adjusting your search or filter options to find what you're looking for."
77-
),
78-
newButtonLabel: i18n.t('New line list'),
79-
},
80-
}
21+
const texts = {
22+
[NO_TYPE]: {
23+
modalTitle: i18n.t('Open'),
24+
loadingText: i18n.t('Loading'),
25+
errorTitle: i18n.t("Couldn't load items"),
26+
errorText: i18n.t(
27+
'There was a problem loading items. Try again or contact your system administrator.'
28+
),
29+
noDataText: i18n.t('No items found. Create a new to get started.'),
30+
noFilteredDataText: i18n.t(
31+
"No items found. Try adjusting your search or filter options to find what you're looking for."
32+
),
33+
newButtonLabel: i18n.t('Create new'),
34+
},
8135

82-
return (texts[type] || texts[NO_TYPE])[key]
36+
[AO_TYPE_VISUALIZATION]: {
37+
modalTitle: i18n.t('Open a visualization'),
38+
loadingText: i18n.t('Loading visualizations'),
39+
errorTitle: i18n.t("Couldn't load visualizations"),
40+
errorText: i18n.t(
41+
'There was a problem loading visualizations. Try again or contact your system administrator.'
42+
),
43+
noDataText: i18n.t(
44+
'No visualizations found. Click New visualization to get started.'
45+
),
46+
noFilteredDataText: i18n.t(
47+
"No visualizations found. Try adjusting your search or filter options to find what you're looking for."
48+
),
49+
newButtonLabel: i18n.t('New visualization'),
50+
},
51+
[AO_TYPE_MAP]: {
52+
modalTitle: i18n.t('Open a map'),
53+
loadingText: i18n.t('Loading maps'),
54+
errorTitle: i18n.t("Couldn't load maps"),
55+
errorText: i18n.t(
56+
'There was a problem loading maps. Try again or contact your system administrator.'
57+
),
58+
noDataText: i18n.t('No maps found. Click New map to get started.'),
59+
noFilteredDataText: i18n.t(
60+
"No maps found. Try adjusting your search or filter options to find what you're looking for."
61+
),
62+
newButtonLabel: i18n.t('New map'),
63+
},
64+
[AO_TYPE_EVENT_VISUALIZATION]: {
65+
modalTitle: i18n.t('Open a line list'),
66+
loadingText: i18n.t('Loading line lists'),
67+
errorTitle: i18n.t("Couldn't load line lists"),
68+
errorText: i18n.t(
69+
'There was a problem loading line lists. Try again or contact your system administrator.'
70+
),
71+
noDataText: i18n.t(
72+
'No line lists found. Click New line list to get started.'
73+
),
74+
noFilteredDataText: i18n.t(
75+
"No line lists found. Try adjusting your search or filter options to find what you're looking for."
76+
),
77+
newButtonLabel: i18n.t('New line list'),
78+
},
8379
}
80+
81+
export const getTranslatedString = (type, key) =>
82+
(texts[type] || texts[NO_TYPE])[key]

0 commit comments

Comments
 (0)