GraphQL string translation

The module exposes the translation field that can be used to retrieve translated interface texts out of drupal.

Usage

query translationQuery($language: AvailableLanguages!) { textOne: translation("Text one", $language) textTwo: translation("Text two", $language) } All the strings are added to Drupal's locale system with the `graphql` context. There's also a simple page showing just them under /admin/config/graphql/string-translation.

Adding new strings

The default setting is that the non-existent strings requested with the field are not added to the translation system. This means that they only have access to the pre-defined list of translatable strings (those with the context set to graphql). New strings can be added in the settings form at /admin/config/graphql/string-translation. This behavior can be overridden by the Request translations of arbitrary strings. Strings requested by the accounts with this permission will be added to the system. The permission has security implications and should be given only to trusted roles.

Requirements