WordPress Glossary Plugin (CMTG) - Integrations - Google Translate
Using Google Translate with the Glossary
Video Guide
The WordPress Glossary plugin Pro+ and eCommerce editions support adding a Google Translate API to tooltips and term pages, to help translate their content from one language to another. This feature is particularly useful in cases where a website is meant to serve a bilingual community.
Requirement: In order for the Google Translate API integration and functionality to work, the server must have a PHP cURL library installed.
You can see whether or not it is installed in the plugins System Information. You can find the System Information by following the User Guide link:
How to integrate Google translate into the glossary?
If you choose to integrate a Google Translate API, you will need to have a Google API key, which can be easily obtained from Google (this of course will cost money based on the usage).
To obtain an API key for translation please follow the Instructions from Google.
Next, enter the settings panel at Admin Dashboard → CM Tooltip Glossary → Settings → API and set the following definitions:
- Add the API key
- Choose a source language (language in which the original text is written).
- Add the target language (to which the original text will be translated) Source and target languages can be also modified using the shortcode
[glossary_translate]
. Read more below.
Further options for the Google translate API integration:
After setting up the technical options there are two ways how the API integration can work.
- Check the box Display translation and original text together? if you want both source language and target language to appear side by side in the tooltip. If it's not checked then only the translation will be displayed.
- Alternatively, you can choose Display translated term name in tooltip? in this case, only the translated term name will be displayed in the tooltip (overwriting the term definition).
How to exclude certain terms from using the Google translate API
Each of your term page editors contains a metabox with tooltip override settings that only apply on the specified term.
Check the box Disable Google API for this term to hide the specified term’s translation on all pages and posts, as shown in the image below:
Using a Shortcode
TIP: What Are Shortcodes
Shortcodes add dynamic content to your site via a small piece of code.
Learn more: Shortcodes - How To Use | Finding ID of Post/Page/Other Content
Google translate is also supported using the shortcode [glossary_translate]
.
This works on every post or page, not only the terms page.
The shortcode includes the parameters term (the Glossary term), and source and target (for the languages).
Example
[glossary_translate term="welcome" source="english" target="spanish"]
Please note that when using this code, you should use brackets - [ ] - instead of braces - { }.
More information about the WordPress Glossary Plugin Other WordPress products can be found at CreativeMinds WordPress Store |
|
Let us know how we can Improve this Product Documentation Page To open a Support Ticket visit our support center |