#24183 closed defect (bug) (fixed)
MediaElement.js i18n issues
Reported by: | SergeyBiryukov | Owned by: | nacin |
---|---|---|---|
Milestone: | 3.6 | Priority: | high |
Severity: | normal | Version: | 3.6 |
Component: | I18N | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
As reported by dimadin in #23282:
MedaElement.js has very poor i18n support that isn't compatible with one we use in WordPress since it relies on browser's language to determine locale, and strings are hardcoded in it (see pull that introduced this).
I looked how to improve this and have it backward compatible and attached patch contains my proposal. Note that this shouldn't go straight to WordPress since it contains changes to MedaElement.js too. I wanted to hear thoughts from others before submitting pull to MedaElement.js. When they add compatible support, we can patch WordPress.
Attachments (11)
Change History (41)
#1
@
11 years ago
While we're at it, could we get http://mediaelementjs.com/ to spell WordPress correctly? :)
#2
@
11 years ago
Can you make a patch for MEjs upstream so we can report here: https://github.com/johndyer/mediaelement/issues/new ?
#3
@
11 years ago
24183.me.patch is a patch for MediaElement.js master branch.
24183.2.patch is a refreshed patch for script-loader.php
.
#4
@
11 years ago
Created a pull request: https://github.com/johndyer/mediaelement/issues/849
#5
@
11 years ago
Pull request was accepted: https://github.com/johndyer/mediaelement/pull/850
#8
@
11 years ago
- Keywords needs-patch added; has-patch removed
Through a change in ME, see https://github.com/johndyer/mediaelement/commit/68ce179cbd, the patch doesn't work.
#9
follow-up:
↓ 10
@
11 years ago
Seems like we could just nest it one level further, maybe?
I do wonder, if mediaelement is already enqueued, how much 24183.diff could break the whole mejs
object.
#10
in reply to:
↑ 9
@
11 years ago
Replying to nacin:
Seems like we could just nest it one level further, maybe?
No, ME.js just overrides it. See https://github.com/johndyer/mediaelement/blob/master/build/mediaelement-and-player.js#L1676
#11
@
11 years ago
So, the problem is that when MEjs tries to use mejs.i18n.locale.strings
, the mejs.i18n
object is already overwritten above with the one that doesn't contain the strings we're trying to add. It also doesn't detect the language we're trying to pass.
24183.me.2.patch is a patch for upstream that makes the most sense to me. It consults a separate mejsL10n
object, which follows the pattern we have in script-loader.php
.
24183.4.patch complements it on our side.
#12
follow-up:
↓ 15
@
11 years ago
If we have to use it as-is, looks like will have to split mediaelement-and-player.js in two files. It has two parts: MediaElement.js at the top, MediaElementPlayer at the bottom. The translation needs to be between them to initialize properly.
#13
@
11 years ago
With mediaelement-and-player.js being an official upstream build, I think we have a good chance of getting a pull request accepted.
(At worst, let's plan on monkey-patching until a PR is accepted.)
#14
@
11 years ago
Created a new pull request: https://github.com/johndyer/mediaelement/pull/940
#15
in reply to:
↑ 12
@
11 years ago
- Keywords has-patch added; needs-patch removed
Replying to azaozz:
If we have to use it as-is, looks like will have to split mediaelement-and-player.js in two files.
24183.4.alt.patch implements that, just in case. Both mediaelement.min.js
and mediaelementplayer.min.js
are also official upstream builds.
#16
@
11 years ago
Pull request was accepted. Once 2.12.1 is out, 24183.4.patch should be good to go.
#17
@
11 years ago
- Keywords commit added
Let's just sit tight for upstream then. By the end of the week, if there is no 2.12.1, we should merge in the patch ourselves.
#23
@
11 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
It seems like [24786] breaks some things. See http://wordpress.org/support/topic/audio-player-controls-disappear-in-rc2.
Currently I only can reproduce it in Opera with a MP3 and MP4 file. Reverting to 24785 shows the controls again.
#24
@
11 years ago
Replacing flashmediaelement.swf
with the one from https://github.com/johndyer/mediaelement/commit/c52d79f0853567190d5a1607d82af0da6eacd66e restores the controls for me.
Milan's patch from #23282