Summary: | Untranslatable warning "Are you sure you want to write off ..." | ||
---|---|---|---|
Product: | Koha | Reporter: | paxed <pasi.kallinen> |
Component: | I18N/L10N | Assignee: | Emma Heath <emmaheath.student> |
Status: | CLOSED FIXED | QA Contact: | Marcel de Rooy <m.de.rooy> |
Severity: | normal | ||
Priority: | P5 - low | CC: | emmaheath.student, f.demians, gmcharlt, jonathan.druart, m.de.rooy |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
See Also: | http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11487 | ||
Change sponsored?: | --- | Patch complexity: | Trivial patch |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: | ||
Circulation function: | |||
Attachments: |
Bug 11488 Untranslatable warning "Are you sure you want to write off ..."
Bug 11488 Untranslatable warning "Are you sure you want to write off ..." [SIGNED-OFF] Bug 11488 Untranslatable warning "Are you sure you want to write off ..." Bug 11488 Untranslatable warning "Are you sure you want to write off ..." |
Description
paxed
2014-01-07 12:38:44 UTC
Created attachment 24320 [details] [review] Bug 11488 Untranslatable warning "Are you sure you want to write off ..." Test plan 1. create some fines 2. to attempt to write off all the fines 3. make sure the messege still displays This has a few problems which need to be addressed: Line 19: A tab character was introduced for indentation. Should be spaces. Line 20: var answer = "confirm(msg); <-- That quotation mark shouldn't be there. But the big problem is that even with these problems corrected the patch doesn't work to make the string translatable. I'm not sure what the cause is, but I have a suggestion which might fix the problem and make the string more translation-friendly. In general it's bad practice to add template variables into the middle of a sentence because it makes assumptions about sentence structure in other languages: _("Are you sure you want to write off [% total | format('%.2f') %] in outstanding fines? This cannot be undone!") It would probably be better to move the template variable to the end. Something like this: _("Are you sure you want to write off these outstanding fines? This cannot be undone! Total writeoff:") + [% total | format('%.2f') %] Finally: The test plan has to include another step: Making sure the translation script really picks up the string: In misc/translator run "perl translate update en-GB" (or whatever language you'd like to test). Check the regenerated po file (en-GB-i-staff-t-prog-v-3006000.po in this case) to make sure the string is there. (In reply to Owen Leonard from comment #2) > > It would probably be better to move the template variable to the end. > Something like this: > > _("Are you sure you want to write off these outstanding fines? This cannot > be undone! Total writeoff:") + [% total | format('%.2f') %] > No. Just... no. That is much worse. Hard-coding the placement of the number will create it's own problems. (In reply to paxed from comment #3) > No. Just... no. That is much worse. Hard-coding the placement of the number > will create it's own problems. Please provide a better alternative, with explanation. Created attachment 24460 [details] [review] Bug 11488 Untranslatable warning "Are you sure you want to write off ..." Test plan: - ./translate update LANG - translate the string into your po file - ./translate install LANG - Verify the string is translated. What about this solution? I think both opinions are valid here. The best way to translate something is with a placeholder in the sentence. Because this way, you can build your sentence the way you want with the variable in whatever position it needs to be. The problem is, that we have to differentiate a bit between TT code and Javascript code, because of bug bug 7327. So if you use + the string will get cut up into small separate pieces that might not be easy to translate if the variable is in the middle of a sentence. So Owen's suggestion makes sense. Could we use a different technique here? Maybe add a placeholder in a different way that is then replaced by the Javascript? I think the datatables navigation/paging seems to do something like this. And just now I see that Jonathan proposed something like it... :) Created attachment 24867 [details] [review] [SIGNED-OFF] Bug 11488 Untranslatable warning "Are you sure you want to write off ..." Test plan: - ./translate update LANG - translate the string into your po file - ./translate install LANG - Verify the string is translated. Signed-off-by: Owen Leonard <oleonard@myacpl.org> Created attachment 24922 [details] [review] Bug 11488 Untranslatable warning "Are you sure you want to write off ..." Test plan: - ./translate update LANG - translate the string into your po file - ./translate install LANG - Verify the string is translated. Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Pushed to master. Thanks, Jonathan! |