glaterza opened a new issue, #45963:
URL: https://github.com/apache/superset/issues/45963

   ### 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:
   
   <img width="464" height="393" alt="A3-datetime-format-description_1-before" 
src="https://github.com/user-attachments/assets/974c4da3-0184-4bbd-9f9f-ccff180c8ec9";
 />
   
   ### 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
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to