#1076 closed defect (invalid)
[patch] Safari has a bug that prevents usage of JS i18n interpolate function
Reported by: | hugo | Owned by: | hugo |
---|---|---|---|
Component: | Internationalization | Version: | |
Severity: | normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Safari has a bug in handling string.replace with a function as the second parameter. That leads to weird output or no translation. This bug needs to be fixed on Safaris side of the things though - unless someone finds a solution in pure JavaScript that works on all browsers (and is fast enough). Yes, the bug is filed for Safari. So this is either to remind me that the problem exist or to find a workaround (if fixing Safari takes too long).
Attachments (3)
Change History (14)
comment:1 by , 19 years ago
Status: | new → assigned |
---|
comment:2 by , 19 years ago
Summary: | Safar has a bug that prevents usage of JS i18n interpolate function → Safari has a bug that prevents usage of JS i18n interpolate function |
---|
comment:3 by , 19 years ago
comment:4 by , 19 years ago
Safari is a rather recent browser and claims to support those recent JavaScript functionality, so it should really support it. Otherwise it is a bug :-)
But feel free to send me a patch that accomplishes the same without using the function as the second argument.
comment:5 by , 19 years ago
Oh, according to the ECMAScript standard, replace with a function as second argument is supported since ECMAScript v3 - and that's from 1999. So that would be enough time for Safari to pick up that feature, don't you think? ;-)
by , 19 years ago
Attachment: | django.i18n.patch added |
---|
comment:6 by , 19 years ago
I just threw together a patch. I didn't test it --- I don't have Safari. I deliberately didn't use Array.push()
because I don't remember, if it is understood by Safari. There is a commented-out if
. I hope you don't need it but if you have a problem with border conditions, you should do something along these lines.
Try it, test border conditions, remove the cruft, and i18n should be okay. If there ia a problem, just let me know.
comment:7 by , 19 years ago
Summary: | Safari has a bug that prevents usage of JS i18n interpolate function → [patch] Safari has a bug that prevents usage of JS i18n interpolate function |
---|
comment:8 by , 19 years ago
Stop the press: String.split()
behaves differently in different browsers. Let me edit the patch.
by , 19 years ago
Attachment: | django.i18n.2.patch added |
---|
by , 19 years ago
Attachment: | django.i18n.3.patch added |
---|
comment:10 by , 19 years ago
Since the bug is resolved in Safari top-of-the-trunk (just got the note from the Safari bugzilla), I think we better wait wether they are about to release a new version (seems likely with all the SVG stuff they did integrate). If they take too long, we can allways go with your patch. thx for that.
comment:11 by , 19 years ago
Resolution: | → invalid |
---|---|
Status: | assigned → closed |
Since this is fixed in Safari I'm marking INVALID -- whenever possible, let's not hack around browser bugs :)
I don't think it is a bug. Only recent versions of JavaScript (1.5?) allows functions as replace() parameter. Before that and from the dawn of times the 2nd parameter should be a string.