About 1st point:
Why not make the language keys also external, then?
A .js file made using php (and returning appropriate headers)
About 2nd point:
About 3rd point:
Unrelated to what I'm mentioning (I think).
Thinking a bit, I believe that what I'm mentioning is actually more unobtrusive than placing as data-* attributes IMO (still... YMMV on that)... And using the external js file made using php may be even more.
Btw, after reading some parts of that file, I can conclude that it has very outdated parts.
A good example of that:
"Unfortunately, Firefox doesn't support the DEFER attribute" (about <script> tags)
So some things do not make sense anymore even though others still do make a lot of sense.