- Issue created by @achap
I have been using the glossary feature for a while and it is working well. Most langcodes in Drupal have an equivalent langcode in Google. E.g. japanese, korean. However, I'm now working on a Hong Kong site with langcode zh-hant-hk. Google does not have a based model for the Hong version of traditional Chinese. It just uses zh-TW (Taiwan) See https://cloud.google.com/translate/docs/languages.
So in my Drupal website I have setup zh-hant-hk and set the remote target to zh-TW per the docs. This means however, that due to the current code, it's not possible to set a specific glossary for zh-hant-hk, because the glossary mapping uses the remote target langcode to check if a glossary exists, not the local drupal langcode.
Our hong kong team needs to be able to setup a hong kong specific glossary for certain terms.
Try and setup a language zh-hant-hk, map it to zh-TW and you will notice that currently the glossary won't work, because it uses getRemoteTargetLanguage for looking up the glossary.
I have cleaned up the arguments passed to executeTranslation as there are too many for yet another argument, so we now have a $translation_context array with all the meta data for the translation. A new language_to_local which represents the Drupal langcode of the translation and then the language_to_remote which is the base model that Google is going to use.
I also fixed a bug where the glossaries weren't being passed recursively with longer text.
I've tested it
N/A
N/A
N/A
Active
1.0
Code