Capture Context From Webpages
Smartling Account Owners and Project Managers can use the Chrome Context Capture Extension to capture context.
The Chrome Context Capture Extension is an add-on for the Chrome browser that captures dynamic HTML context for a web application as you browse. Any content you can display in a browser can be contextualised this way.
You can also use browser automation software such as Selenium to automate context capture, or simply provide your sitemap and have the extension crawl your site.
Only use the Chrome extension on source language sites. For example, if your primary web site is "smartlinghotels.com" and the Spanish version is "es.smartlinghotels.com", only use the extension on "www.smartlinghotels.com".
Take a Snapshot
- Install the Chrome Content Capture extension via the Chrome Store.
- Browse to the page you want to contextualize. Strings on the page should match strings already uploaded to a Smartling project.
- Click the Context Capture toolbar button. The extension will capture the current state of the page at the moment you click. If you want to capture a dynamic element such as a modal dialog, make sure that element is displaying on the page before you click the toolbar button.
- Login and, from the drop-down, select the destination project for the snapshot. You can preview the snapshot by clicking Preview.
Note: The Context Capture Extension does not yet support login with a Google ID. You’ll need to use your Smartling ID to login.
- Click Send.
Smartling posts the snapshot to the selected project. If it matches uploaded strings, Smartling displays the snapshot to translators when they edit strings.
Targeting Specific Strings
By default, a Chrome Context snapshot will capture all strings visible on a page at that moment. You can use the string selection tool to target specific strings for contextualization and exclude strings for which the snapshot will not provide good context. For example, if you want to capture context for a modal dialog in the middle of the page, but exclude strings outside that dialog, use the selection tool to target only the dialog and its strings. Using this function will [overwrite](doc:chrome-context-capture-extension-override-existing-context) any existing context for your selected strings.
To use string selection:
- Follow the instructions for taking a snapshot, but before sending, click Select strings.
- In the snapshot preview, select strings or regions of the page with the selection tool.
If you select a region, all visible strings within that region will be included in your selection. You can also click Select Whole Page.
- When you have finished making your selection, click Send.
The History function displays a list of context snapshots and statistics about the number of successful string matches.
- From the Context Capture toolbar button, click the **Gear > History**. The Feedback dialog displays a list of context snapshots with information such as the number of strings updated and matched. Note, that a snapshot will only be created if context has been updated for at least one string.
- If your submission matches strings in the project, clicking the view link displays the new context snapshot.
- Clicking Clear History allows you to clear the history log. This will not affect context already in the Dashboard.
Improve Context Matching With Instrumented Files
Using an instrumented resource file in a test environment can help you get faster and more accurate context matching with the Chrome Context Capture Extension.
Instrumented files are a modified version of the original file with each string wrapped in invisible unicode characters generated from the string’s hashcode. On the page, strings will look exactly the same, but The Chrome Context Capture Extension can match them exactly with their equivalent strings in a Smartling project. The effects of using an instrumented file include:
- Context matching completes faster.
- Each variant of a string will match to its correct context.
- If the Chrome Context Capture Extension detects at least one instrumented string on a page, only instrumented strings will be matched. This is helpful for targeting context matching to specific strings, especially when using automation.
To use instrumented files:
- From Content > Files, download the instrumented files containing the strings you want to contextualize. You can also download instrumented files via the API.
- Deploy your web application using the instrumented files.
- Use the Chrome Context Capture Extension to take context snapshots in your test environment.
Setting a Keyboard Shortcut
To make it easier to capture difficult-to-expose elements of a page, you can set a keyboard shortcut to take a snapshot.
- In the Chrome browser, navigate to Chrome > Preferences > Extensions and click Keyboard Shortcuts.
- In the Smartling Context Capture section, type a keyboard shortcut and click OK.
- In Chrome > Preferences > Extensions, find the Chrome Context Capture Extension, and click Options, or right click the extension and select Options.
- There's also the ability to enable Autocapture. To use this feature, once you select Options, hold down the Shift + Alt/Option + A keys. You'll also need to enter an API key and a UID. To retrieve these, go to Smartling > Projects > API. For the API key field, enter the Smartling API key. For the UID field, enter the Project ID.
- Follow the procedure for Taking a Snapshot
Capturing Context on iFrame Sites
Iframes are windows within a webpage that contain a separate web page, such as a web form. A regular snapshot using the Chrome Context Capture Extension will not capture content within an iframe.
Right-click on the iframe window and from the drop-down menu, select Capture iframe, then follow the procedure to Capture a Snapshot.