Skip to content

Commit

Permalink
Revert "fix: ensure translations for strings are replaced at runtime"
Browse files Browse the repository at this point in the history
This reverts commit 393ffb9.
  • Loading branch information
edoardo committed Nov 1, 2024
1 parent 78bfdf7 commit 492b568
Showing 1 changed file with 60 additions and 61 deletions.
121 changes: 60 additions & 61 deletions src/components/OpenFileDialog/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,66 +18,65 @@ export const AOTypeMap = {

const NO_TYPE = 'NO_TYPE'

export const getTranslatedString = (type, key) => {
const texts = {
[NO_TYPE]: {
modalTitle: i18n.t('Open'),
loadingText: i18n.t('Loading'),
errorTitle: i18n.t("Couldn't load items"),
errorText: i18n.t(
'There was a problem loading items. Try again or contact your system administrator.'
),
noDataText: i18n.t('No items found. Create a new to get started.'),
noFilteredDataText: i18n.t(
"No items found. Try adjusting your search or filter options to find what you're looking for."
),
newButtonLabel: i18n.t('Create new'),
},

[AO_TYPE_VISUALIZATION]: {
modalTitle: i18n.t('Open a visualization'),
loadingText: i18n.t('Loading visualizations'),
errorTitle: i18n.t("Couldn't load visualizations"),
errorText: i18n.t(
'There was a problem loading visualizations. Try again or contact your system administrator.'
),
noDataText: i18n.t(
'No visualizations found. Click New visualization to get started.'
),
noFilteredDataText: i18n.t(
"No visualizations found. Try adjusting your search or filter options to find what you're looking for."
),
newButtonLabel: i18n.t('New visualization'),
},
[AO_TYPE_MAP]: {
modalTitle: i18n.t('Open a map'),
loadingText: i18n.t('Loading maps'),
errorTitle: i18n.t("Couldn't load maps"),
errorText: i18n.t(
'There was a problem loading maps. Try again or contact your system administrator.'
),
noDataText: i18n.t('No maps found. Click New map to get started.'),
noFilteredDataText: i18n.t(
"No maps found. Try adjusting your search or filter options to find what you're looking for."
),
newButtonLabel: i18n.t('New map'),
},
[AO_TYPE_EVENT_VISUALIZATION]: {
modalTitle: i18n.t('Open a line list'),
loadingText: i18n.t('Loading line lists'),
errorTitle: i18n.t("Couldn't load line lists"),
errorText: i18n.t(
'There was a problem loading line lists. Try again or contact your system administrator.'
),
noDataText: i18n.t(
'No line lists found. Click New line list to get started.'
),
noFilteredDataText: i18n.t(
"No line lists found. Try adjusting your search or filter options to find what you're looking for."
),
newButtonLabel: i18n.t('New line list'),
},
}
const texts = {
[NO_TYPE]: {
modalTitle: i18n.t('Open'),
loadingText: i18n.t('Loading'),
errorTitle: i18n.t("Couldn't load items"),
errorText: i18n.t(
'There was a problem loading items. Try again or contact your system administrator.'
),
noDataText: i18n.t('No items found. Create a new to get started.'),
noFilteredDataText: i18n.t(
"No items found. Try adjusting your search or filter options to find what you're looking for."
),
newButtonLabel: i18n.t('Create new'),
},

return (texts[type] || texts[NO_TYPE])[key]
[AO_TYPE_VISUALIZATION]: {
modalTitle: i18n.t('Open a visualization'),
loadingText: i18n.t('Loading visualizations'),
errorTitle: i18n.t("Couldn't load visualizations"),
errorText: i18n.t(
'There was a problem loading visualizations. Try again or contact your system administrator.'
),
noDataText: i18n.t(
'No visualizations found. Click New visualization to get started.'
),
noFilteredDataText: i18n.t(
"No visualizations found. Try adjusting your search or filter options to find what you're looking for."
),
newButtonLabel: i18n.t('New visualization'),
},
[AO_TYPE_MAP]: {
modalTitle: i18n.t('Open a map'),
loadingText: i18n.t('Loading maps'),
errorTitle: i18n.t("Couldn't load maps"),
errorText: i18n.t(
'There was a problem loading maps. Try again or contact your system administrator.'
),
noDataText: i18n.t('No maps found. Click New map to get started.'),
noFilteredDataText: i18n.t(
"No maps found. Try adjusting your search or filter options to find what you're looking for."
),
newButtonLabel: i18n.t('New map'),
},
[AO_TYPE_EVENT_VISUALIZATION]: {
modalTitle: i18n.t('Open a line list'),
loadingText: i18n.t('Loading line lists'),
errorTitle: i18n.t("Couldn't load line lists"),
errorText: i18n.t(
'There was a problem loading line lists. Try again or contact your system administrator.'
),
noDataText: i18n.t(
'No line lists found. Click New line list to get started.'
),
noFilteredDataText: i18n.t(
"No line lists found. Try adjusting your search or filter options to find what you're looking for."
),
newButtonLabel: i18n.t('New line list'),
},
}

export const getTranslatedString = (type, key) =>
(texts[type] || texts[NO_TYPE])[key]

0 comments on commit 492b568

Please sign in to comment.