Bug 1047215 - [Gallery/Video]Background Overlays are not translated

This PR incorporates the patch from bug 1038984 as those changes to dialogs.js are required for this patch.
That code was added for bug 1038984 (PR https://github.com/mozilla-b2g/gaia/pull/21885) by giovannic. I will NI him on the bug to get his response.