Unknown language json files

Situation

Since some version ago (currently running 5.0.3) some plugin updates generate translation files like wp-content/languages/de_DE-1aeac217128913231c1a10ae951869.json

We use two systems, one for local testing, and a live system. Updates are performed on the local system and then pushed to live via git.

We use two languages, English as 1st and German as 2nd

Questions

  1. what are these language files for? (I guess it is for localizing javascript?)
  2. is it necessary to add/commit/push them to the live server?
  3. why do they have such a strange name scheme? Nobody can guess what they’re for from just looking at the file name…

2 Answers
2

  1. what are these language files for? (I guess it is for localizing javascript?)

You guessed right. The JSONs are for use specifically with the new wp_set_script_translations function in WordPress 5.

  1. is it necessary to add/commit/push them to the live server?

They are used at runtime, just like .mo files are. So yes, add them to your deployment if you want the translations to work.

(Note that currently the JSON translations are only used by admin screens, but this could change at any time and will also start applying to theme and plugin translations)

  1. why do they have such a strange name scheme? Nobody can guess what they’re for from just looking at the file name…

The names are derived from the script that uses each file.

From your example: the first string in the file is "Reusable Blocks". This is used by the script at wp-includes/js/dist/blocks.min.js – Take off the .min and the MD5 hash is 1a0cd6a7128913b15c1a10dd68951869.

It’s not possible to know which script it’s required for without searching the code, but there’s a ticket open about that.

Leave a Comment