Overview

I had the opportunity to get a list of untranslated nodes in Drupal, so this is a personal note for future reference.

Method

There are various approaches, but this time I use JSON:API.

Let’s assume the master language is Japanese (ja) and the translation language to add is English (en).

Using JSON:API, for example, for a taxonomy called collection, you can retrieve it with the following:

https://xxx/jsonapi/taxonomy_term/collection

Additionally, by adding /en as follows, if a translation node exists, that information is returned.

https://xxx/en/jsonapi/taxonomy_term/collection

In this case, if a translation node exists, attributes/langcode becomes en, but for nodes without translations, it remains ja.

{""""""}}}}"{"""""}}""""""jvmlsh,dtilsh,addlrrseeieraydiertrraeeortnletp"nletuunvvnsakffae:kffrppgiiai"s""""s""iaacsspo:"::::""::blloiiin:1:u__doo""{{"["e{"tiienn::{ht3{henn"__tadtstt:cl{"tx1t"eero1poep:rr"eg.:n6snnea_0/of:{aantm"/m-/ll"ee,jy5/__,dss_1x__"sot7xtr:ane8xiegar-/dvnepm4e"iu"i-9n:sl:.-8/iloc0j1o,nro-s9nugl9o,_l/l6nilfebad,ocdp"rt-i:mi7/aobt1tn0a9/"4x,1,5o.fn02o/cm"cy6_6tee"r,m/collection/1e3d1e6f-5178-4980-96bd-7b045f2cc66e?resourceVersion=id%3A19"

Using this property, when a language code different from the specified language is contained in langcode, it can be extracted as a node without a translation for that language.

Note that based on the JSON:API specification, pagination can be performed using page queries as follows. This is used for bulk data retrieval.

https://xxx/en/jsonapi/taxonomy_term/collection?page[offset]=50&page[limit]=50

Summary

There may be better methods, but I hope this serves as a useful reference.