Problem/Motivation
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.
Steps to reproduce
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.
Proposed resolution
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.
Remaining tasks
I've tested it
User interface changes
N/A
API changes
N/A
Data model changes
N/A
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 3528323_3.patch | 5.6 KB | achap |
Issue fork tmgmt_google_v3-3528323
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3528323-allow-to-specify
changes, plain diff MR !7
Comments
Comment #3
achapAttaching a patch from the MR for composer
Comment #6
kallado commented@achap commited
Comment #7
kallado commentedFixed in 1.0.5