-
Notifications
You must be signed in to change notification settings - Fork 14.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: translating variables #20080
base: master
Are you sure you want to change the base?
fix: translating variables #20080
Conversation
@villebro , i will be glad to discuss with you about variable translation. Without adding translation on those varaibles, we have any translation on the second part of those sentence I understand your worries about that, and i will be glad to understand any other solution to solve that problem |
@aehanno can you show a before and after of these changes? I'd like to understand how these translations are being picked up |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #20080 +/- ##
===========================================
- Coverage 67.47% 56.44% -11.04%
===========================================
Files 1880 1880
Lines 72283 72282 -1
Branches 7881 7880 -1
===========================================
- Hits 48772 40797 -7975
- Misses 21486 29460 +7974
Partials 2025 2025
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Hey @villebro, yes of course, I can show you an exemple. For this one, I added modification in SliceAdder.jsx file, There is before my correction And this one is after my correction We can see the second part is well translate in the second image |
# Conflicts: # superset/translations/fr/LC_MESSAGES/messages.json
@@ -51,7 +52,7 @@ const FilterIndicator: FC<IndicatorProps> = ({ | |||
{name} | |||
{resultValue ? ': ' : ''} | |||
</Title> | |||
<FilterValue>{resultValue}</FilterValue> | |||
<FilterValue>{t(resultValue)}</FilterValue> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like something that might not have a static/expected value, is that correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey in my understanding of the translation framework, it does static analysis of the code to find translatable strings, it only works on constants not on variables.
@@ -314,7 +314,7 @@ export default function DateFilterLabel(props: DateFilterControlProps) { | |||
<Divider /> | |||
<div> | |||
<div className="section-title">{t('Actual time range')}</div> | |||
{validTimeRange && <div>{evalResponse}</div>} | |||
{validTimeRange && <div>{t(evalResponse)}</div>} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here... is this something we would expect to have in the translation files, or is it a more dynamic value (as it sounds, based on the name)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's a date or it's write 'No filter', so I think in fact that will juste translate 'no filter' and don't touch to other result
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's worth putting a little ternary condition or similar in there, e.g. evalResponse = 'no filter' ? t('no filter') : evalResponse
? Or maybe there's somewhere further upstream in the code that's more appropriate to the the translation?
"Sum as Fraction of Columns": ["Somme comme fraction des colonnes"], | ||
"Count as Fraction of Total": ["Décompte comme fraction du total"], | ||
"Count as Fraction of Rows": ["Décompte comme fraction des lignes"], | ||
"Count as Fraction of Columns": ["Décompte comme fraction des colonnes"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mistercrunch do the above translations look correct to you?
Looks like this needs a rebase. There have been some other PRs recently adding translations as well, so I hope it's not too painful. We also still need some validation of the language itself, if @mistercrunch or anyone else that speaks French has time to scope it out :) |
Sadly, it looks like this never passed, CI, never got validation of the translated strings, and now is in need of a rebase again. @aehanno would you mind doing a rebase, and we can try again to get this across the finish line? Thanks! |
"No matching records found": ["Aucun résultat trouvé"] | ||
"No matching records found": ["Aucun résultat trouvé"], | ||
"Trend": ["Tendance"], | ||
"Total (Count)": ["Total (Somme)"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Count != Somme
more like "Compte" ou "Nombre"
@@ -3877,7 +3877,27 @@ | |||
], | |||
"Scope": ["Périmètre"], | |||
"Dependent on": ["Dépend de"], | |||
"No matching records found": ["Aucun résultat trouvé"] | |||
"No matching records found": ["Aucun résultat trouvé"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't the .json
file generated here? shouldn't this be in the .po
file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes indeed! I thought that was covered in this PR, but that doesn't seem to be the case.
Looks like the comments on the PR were never addressed, and now it's in need of a rebase. I'll go ahead and convert this to draft. If you want to bring it back up to a mergeable state, that would be fantastic, but if not, we'll close this eventually. Thanks in any case! |
SUMMARY
translating variables
ADDITIONAL INFORMATION
Fixes #20060