How GlobalLink Web Works
Overview
GlobalLink Web observes Document Object Model (DOM) changes and walks the DOM to collect translatable text nodes when the page is loaded. These text blocks are matched against the Pretranslate array, and any blocks missing from the Pretranslate array are sent to a Translation API. GlobalLink Web then replaces the text nodes with their localized equivalents. Once the page is translated, GlobalLink Web continues listening to the DOM via a MutationObserver for any dynamic changes or interactive content that may need a translation. When a modification is detected, this process starts over. For sites that do not use Pretranslation, untranslated text blocks go straight to the Translation APIs and skip the Pretranslation grid.
MutationObserver Support
If a browser does not support MutationObserver, it will be unable to run GlobalLink Web. You can find more information about the MutationObserver here.
Browser Mechanism
Step1
The first step is content extraction. GlobalLink Web collects content by filtering for text nodes and translatable attributes.
Step 2
Text blocks are checked against the Pretranslate array, and any missing blocks are sent to the Translation API.
Step 3
The page is updated with the localized text equivalents. GlobalLink Web continues listening to the page for any dynamic changes or interactive content and proceeds through the translation cycle again if necessary.
Cloud-Based APIs
GlobalLink Web relies on the following restful APIs to translate a page:
API Name | Purpose |
---|---|
/xapis/Pretranslate/<key>/.js | Project-specific code for triggering translation |
/xapis/Pretranslate/<url_hash>/[all|spider].json | Provides a pre-optimized translations array for a particular URL |
/xapis/Translate | Provides ad hoc translations that Pretranslate did not cover |
/xapis/ContentPage | Adds new text blocks that need translations |
/xapis/TranslateStats | Reports block usage statistics for speed optimizations. |
These APIs reside on www.onelink-edge.com and are Geo-IP optimized where possible with CloudFront.