superset icon indicating copy to clipboard operation
superset copied to clipboard

"Datetime format" help in the dataset editor is split into five translatable fragments

Open glaterza opened this issue 1 month ago • 1 comments

Problem

The dataset editor shows a help tooltip next to "Datetime format" in the details of each column. The code builds this text from five t() calls and two links (superset-frontend/src/components/Datasource/components/DatasourceEditor/DatasourceEditor.tsx:826-847). Translators get five separate msgids, so they cannot write one sentence in their language:

  • The code fixes the word order around the two links.
  • The last msgid keeps the line breaks and the indentation of the source file.

A code comment above the block already says "fragmented translations may not work".

The catalogs show the result. All 29 non-English catalogs translate the first fragments. Only de translates the last fragment. Users in the other 28 languages see the tooltip half in their language and half in English.

The Python link also points to the Python 2 documentation (docs.python.org/2).

Steps to reproduce

  1. Switch the UI language to Spanish, or any language except English and German.
  2. Open a chart, then edit its dataset.
  3. Open the Columns tab and expand a column.
  4. Hover the info icon next to the "Datetime format" field.

The tooltip starts in Spanish and ends in English:

A3-datetime-format-description_1-before

Expected behavior

The tooltip is one sentence in the user's language, with both links.

Proposed fix

  • Translate the text with one t() call. Write the two links as markdown links with named URL placeholders, for example [ISO 8601](%(iso_url)s). Render the result with SafeMarkdown.
  • Add an i18n: translator comment: keep the link syntax and both placeholders.
  • Point the Python link to https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior.
  • Regenerate messages.pot and the catalogs with scripts/translations/babel_update.sh.

The new msgid starts untranslated in every catalog. Until a language translates it, its users see the whole sentence in English instead of half of it. I can open the PR and add the Spanish translation.

Same pattern elsewhere

These sentences are also split into several t() calls around a link (master at 54304a7e32):

File Sentence starts with
src/SqlLab/components/TemplateParamsEditor/index.tsx:79 "…by using" + link "Jinja templating"
src/components/ImportModal/ErrorAlert.tsx:52 "…installation instructions: " + link "here"
src/components/ImportModal/ImportErrorAlert.tsx:48 "…installation instructions: " + link "here"
src/components/ErrorMessage/OAuth2RedirectMessage.tsx:189 "You need to" + link "provide authorization"
src/dashboard/components/EmbeddedModal/index.tsx:190 "For further instructions, consult the" + link
src/dashboard/components/gridComponents/Tab/Tab.tsx:344 "You can" + link "create a new chart"
src/features/themes/ThemeModal.tsx:644 "Design with" + link "Ant Design Theme Editor"
src/features/datasets/AddDataset/LeftPanel/index.tsx:194 "Manage your databases" + link "here"
src/features/databases/DatabaseModal/index.tsx:1291 "…how to connect a database driver " + link "here"
src/features/databases/DatabaseModal/index.tsx:2227 "…requirements your databases has " + link "here"
src/features/databases/DatabaseModal/SqlAlchemyForm.tsx:89 "Refer to the" + link
src/features/databases/DatabaseModal/ModalHeader.tsx:127 "…Learn how to connect your database" + link "here"
src/features/databases/DatabaseModal/ModalHeader.tsx:175 "Need help? Learn more about" + link
plugins/plugin-chart-handlebars/src/plugin/controls/handlebarTemplate.tsx:54 "See " + link

Several of these links open in a new tab with target="_blank". SafeMarkdown drops the target attribute. So these sites need a decision first: extend SafeMarkdown, or add a small helper that inserts React elements into a translated string. I propose to fix the "Datetime format" tooltip first and to discuss the other sites here.

Superset version

master / latest-dev

Browser

Chrome

glaterza avatar Nov 02 '26 21:11 glaterza

I saw the linked PRs and would like to help validate the tooltip change. I can compare the tooltip in English and Spanish, check that the links still render and work, and report any remaining untranslated fragments. Would that be useful, and is there a particular PR you’d prefer me to test?

Orcus01 avatar Nov 06 '26 12:11 Orcus01