Consult Smartling Professional Services about configuring Static Cache on your website.
Smartling offers a translation caching feature to help prevent untranslated content from appearing on your localized sites, called Static Cache. Untranslated content can appear when you publish changes to your source site before the translation process has been completed.
Static Cache allows you to take a snapshot of the current state of your translated pages, which are served to your site visitors. Once new content has been fully translated for a given page, your translation cache will automatically reset, bringing the localized page in sync with your source site.
Static Cache works on a string-level rather than an entire page-level, meaning it initiates moments after a string is published in Smartling. It checks to make sure that there is a supply of translated strings to provide to the page before updating the cache.
Important Considerations
Static Cache is a good fit for static sites. It may not be a fit for sites with dynamic elements such as a login, booking engine, shopping cart or that are customized based on users (e.g. cookies).
Any assets that are not going through the proxy (loaded from your source site instead of your localized site) will not be cached. By default, CSS files and images will not be cache and any assets larger than 1 MB will not be cached.
Additionally, if your cached assets are not requested for 30 days, the cache for this asset will be cleared. This is done to ensure we do not have outdated content on your site.
Finally, the static cache can prevent new content from appearing on a page that has been cached. It cannot prevent net new pages from appearing on your localized sites.
Contact your Customer Success Manager to discuss if Smartling's Static Cache is a good fit for your site.
Enable Caching
Once the caching feature has been enabled for your account:
- From within your Global Delivery Network project, click on Project Settings > Static Cache.
- Click the Bleedthrough Projection toggle to ON.
- Choose to enable caching for any localized domain listed in your project by toggling ON as required.
Once caching has been enabled for a site, you will need to set the cache for each page for each language you support. This happens when a localized page is visited. You can quickly populate the cache by using a crawler, by organic traffic, or manually by browsing each of your translated websites.
From then on, requests to that site will be served from the cache and any changes to your source site will not be reflected on cached pages.
Reset Cache
There are two ways to reset the cache for a localized page - automatic and manual:
Automatic
When all new strings on a page for a particular localized site have reached the published state, the cache for that page will be reset automatically.
Manually
You can reset the cache for an entire domain by clicking Reset from the Static Cache configuration page (Global Delivery Network > Configuration > Static Cache). If you want to reset only a specific page or directory, enter the URL or directory in the text box and click Reset. You can also enter the URL of an asset, such as a style sheet or JavaScript file.
You can also append the URL parameter ?smartling_editmode=5 to the end of any localized page URL to use the inline browser tool to manage the cache for a translated page.
Some sites rely on non-HTML assets, most commonly CSS or JavaScript files, for serving content. These assets will not be captured by the automatic cache reset when strings on a page are translated, or by using the inline CAT tool. To reset these assets, you must use the Static Cache Configuration page and specify the URL of the asset.
How to Tell if a Resource is Cached
There are two ways to tell if a resource is cached:
- Use a Preview Mode. Append the URL parameter ?smartling_editmode=5 to your localized site. At the bottom of your page you will see a dialogue that shows the cache status of the page. This is useful for checking if the HTML of the page is cached.
- View Response Headers. All cached resources will have a response header of X-SL-Cached. If the value of this header is 0 this means that the resource was not served from cache. If the value of this header is 1 this means that the resource was loaded from cache.
If you are looking to optimize performance and page speed, consider using a Content Delivery Network instead of Static Cache.
Lock a Cached Page
A page can be locked in its cached state to preserve a page until it is manually unlocked. Using ?smartling_editmode=5, the "Lock page" checkbox will appear in the cache toolbar at the bottom of the page.