#5636 - fixing i18n translation problem for date picker labels#5647
#5636 - fixing i18n translation problem for date picker labels#5647kanasznagyzoltan wants to merge 1 commit into
Conversation
|
Thanks for your fix for this @kanasznagyzoltan! The bug seemed to occur on sandbox but not the demo site, so this may only affect |
GauravD2t
left a comment
There was a problem hiding this comment.
thanks for the contribution!
1.Old keys are now unused: form.date-picker.placeholder.year/month/day exist in all 37 language files (including en.json5 lines 7479-7483) but are no longer referenced in the code.
Recommendation
Either:
Option A: Revert date-picker to use the existing translation keys (form.date-picker.placeholder.year/month/day) which are already translated in all languages
Option B: Complete the translation updates for all 37 language files before merging, ensuring form.number-picker.label.Year/Month/Day are properly translated in every language
tdonohue
left a comment
There was a problem hiding this comment.
@kanasznagyzoltan : Thanks for this PR. However, based on a code review only, I think these i18n keys you've created all should be lowercased to match what is in the English file (en.json5). See notes inline below
| [value]="year" | ||
| [invalid]="showErrorMessages" | ||
| [placeholder]="'form.date-picker.placeholder.year' | translate" | ||
| [placeholder]="'Year'" |
There was a problem hiding this comment.
@kanasznagyzoltan : As @GauravD2t pointed out, I think these placeholders need to be lowercased. In the en.json5 file the i18n keys are as follows:
"form.date-picker.placeholder.year": "Year",
"form.date-picker.placeholder.month": "Month",
"form.date-picker.placeholder.day": "Day",
But, by making this uppercased Year, you are trying to use a non-existent key of form.date-picker.placeholder.Year instead of form.date-picker.placeholder.year.
| // "form.number-picker.label.Year": "Year", | ||
| // TODO New key - Add a translation | ||
| "form.number-picker.label.Year": "Year", | ||
| "form.number-picker.label.Year": "Év", |
There was a problem hiding this comment.
These should also be lowercased to match the en.json5 file. So this should be form.number-picker.label.year
References
Description
Fixes a broken double-translation chain in the date picker form labels that caused raw i18n key strings (e.g.
form.number-picker.label.Év) to be rendered instead of translated text in non-English languages.Instructions for Reviewers
Root Cause
date-picker.component.html passed
[placeholder]="'form.date-picker.placeholder.year' | translate"to<ds-number-picker>. Thenumber-pickercomponent then used that value to construct a second translation key:'form.number-picker.label.' + placeholder. This created a two-step chain:form.date-picker.placeholder.year→"Year"→form.number-picker.label.Year✓form.date-picker.placeholder.year→"Jahr"→form.number-picker.label.Jahr✗ (key does not exist → raw key string rendered)form.date-picker.placeholder.year→"Év"→form.number-picker.label.Év✗The bug was latent until
form.date-picker.placeholder.*keys were properly translated in non-English language files — at which point the dynamically constructed lookup key no longer existed.List of changes in this PR:
| translatepipe from all three[placeholder]bindings. Now passes static English key suffixes ('Year','Month','Day') directly so thatnumber-pickerowns all translation logic internally.titleandaria-labelattributes to resolve('form.number-picker.label.' + placeholder | translate)as the{{field}}interpolation value, so accessibility strings also display the localized field name correctly.form.number-picker.label.Year,form.number-picker.label.Month, andform.number-picker.label.Dayto allow testing. Full Hungarian translation is covered separately in Fixes #5633 - [i18n] Update and complete Hungarian (hu) translations for DSpace 10 #5634.How to test:
Checklist
This checklist provides a reminder of what we are going to look for when reviewing your PR. You do not need to complete this checklist prior creating your PR (draft PRs are always welcome).
However, reviewers may request that you complete any actions in this list if you have not done so. If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!
mainbranch of code (unless it is a backport or is fixing an issue specific to an older branch).npm run lintnpm run check-circ-deps)package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.