Translations not working
If the translation doesn't go through, check if there is any error message in the access logs.
Here are some known issues.
Unexpected string escaped character '&'
If you see this error message:
Unexpected string escaped character '&'
...like here:
{"message":"Unexpected string escaped character '&'","locations":[{"line":2596,"column":87}],"extensions":{"code":"gqlparser@4","specifiedBy":"https:\/\/spec.graphql.org\/draft\/#sec-Language"}}
The solution is: deactivate and reactivate the plugin.
After you do so, if you have any DB cache plugin, you must also flush the DB cache.
Explanation:
The source of the issue is that GraphQL query "translate-customposts"
has been stored erroneously in the database.
It seems to happen only the first time the plugin is installed, and only if the license had been provided in advance, so this error is very rare.
For some reason (that escapes to us), WordPress may corrupt the content of the query when storing it.
Even though the original query reads this:
@underJSONObjectProperty(
by: { key: "coreMediaTextAlt" }
affectDirectivesUnderPos: [1, 6]
)
@underJSONObjectProperty(
by: { key: "from" }
affectDirectivesUnderPos: [1, 4],
)
@underEachJSONObjectProperty
@underEachArrayItem(
passValueOnwardsAs: "value"
)
@applyField(
name: "_sprintf",
arguments: {
string: "#(<!-- wp:media-text .*?-->\\n?<div .*><figure .*><img .*?alt=\\\")%s(\\\")#",
values: [$value]
},
setResultInResponse: true
)
@export(
as: "coreMediaTextAltReplacementsFrom",
)
@underJSONObjectProperty(
by: { key: "to" }
)
@export(
as: "coreMediaTextAltReplacementsTo",
)
...WordPress stores it in the DB like this:
@underJSONObjectProperty(
by: { key: "coreMediaTextAlt" }
affectDirectivesUnderPos: [1, 6]
)
@underJSONObjectProperty(
by: { key: "from" }
affectDirectivesUnderPos: [1, 4],
)
@underEachJSONObjectProperty
@underEachArrayItem(
passValueOnwardsAs: "value"
)
@applyField(
name: "_sprintf",
arguments: {
string: "#(<!-- wp:media-text .*?-->\\n?<div><figure><img .*?alt=\\\")%s(\\\")#",
values: [$value]
},
setResultInResponse: true
)
@export(
as: "coreMediaTextAltReplacementsFrom",
)
@underJSONObjectProperty(
by: { key: "to" }
)
@export(
as: "coreMediaTextAltReplacementsTo",
)
When disabling and re-enabling the plugin, the query is re-saved in the database, and the issue is fixed.