WordPress Connector

WordPress Connector Install and Configure

Smartling’s WordPress Connector allows you to integrate Smartling translations into your WordPress site. The Connector uploads new content to Smartling and downloads translations to the appropriate site.

Prerequisites

Before you can install the Smartling Connector, you need the following in your WordPress installation:

  • WordPress 4.6 or higher
  • Multisite mode enabled
  • Multilingual Press free plugin installed
    • PHP Version 5.5 or higher
    • PHP extensions
    • mbstring
    • curl
    • libxml
    • xml
    • xmlreader
    • xmlwriter
    • yaml
    • gd
  • For WP Enging hosting maximum execution time is set to 300 seconds
  • Smartling Connector write access for the following folders:
    • smartling-connector logs directory (wp-content/plugins/smartling-connector/logs)
    • system temp
    • wordpress uploads and all subfolders (wp-content/uploads)

In Smartling, you will need a project of the CMS Connectors type.

Configure Multilingual Press Plugin

For each translated language, you will need to add a site.

  1. Go to My Sites > Network Admin > Sites (/wp-admin/network/sites.php).
    network_admin.png
  2. Click Add New to add a new site.
    add_new_site.png
  3. Enter the details about the source or translated site in the fields in the Add New Site section:
    • Site Address (URL): Depending on your WordPress network configuration you can specify a domain or path of your new site. For additional information, see switching network types.
    • Site Title: The title of the new site. This can be changed later.
    • Site Language: The language for the WordPress Admin UI. This configuration doesn’t affect content that will be managed manually, or by the connector.
    • Admin Email: The site will be linked to this user, allowing the user to log in and run the site. You can enter an email for an existing user, or enter a new email address that isn't already on this site. If the email address is new, WordPress will create a new user, and send login instructions to that user.
  4. On the Multilingual Press section, in the Language box, select the site language. Language is displayed in Smartling widgets, which helps identify target blogs. If you have two language versions (for example, English and French) of the same blog post and they have the same title (for example, Canada blog), the Language value will be appended when the blog posts are displayed (for example, “Canada blog - en-CA” and “Canada blog - fr-CA”).
  5. In Relationships, do one of the following:
    • For your original site only, select the checkbox next to each translated site.
    • For translated sites, select the checkbox next to the original site.
  6. Leave Based on site unselected.
    If a site is selected in Based on site, Multilingual Press will clone the original content to the new localized site. Smartling will not build relationships between the original and cloned content, and the connector will duplicate content to the localized site when you upload it to the original one.
  7. In Search Engine Visibility, select or clear the Discourage search engines from indexing this site box. You may want to select this option for a sandbox site, or one that is not yet launched.
  8. Click Add Site.

Install Smartling Plugin

  1. Go to Network Admin > Plugins > Add new (/wp-admin/network/plugin-install.php).
  2. Type smartling in the Search Plugins box to locate the Smartling plugin.
  3. Follow the WordPress documentation to install and activate the Smartling plugin.
    add_plugins.png
  4. The following error messages may be displayed. The last two will be resolved as you continue with configuration. To resolve the Advanced Translator error, click this link in the error text.
    config_profiles.png
  5. On the Multilingual Press settings page, clear the Advanced Translator box, and then click Save changes.
    advanced_translator.png

Configure Smartling Plugin

Before you begin, you will need the following details in order to configure the Smartling plugin:
- User Identifier and Secret Token: See Authentication.
- Project ID and target locales: You can find these while viewing your project in Smartling. Select API from the top menu, and then select the v 1.0 tab. Project Settings > API.

api.png

  1. In WordPress, go to Smartling > Settings (/network/admin.php?page=smartling-settings).
    smartling.png
  2. Click Add Profile.
    add_profile.png
  3. In the Account Info section, set the following fields:
    • Profile Name: Enter a descriptive name for the profile.
    • Active: Select Active if you want to use this profile right away.
    • Project ID: See note at the beginning of this section.
    • User Identifier
    • Token Secret
      profile_setup.png
  4. In Source Locale, select the original content site language, and then click Save changes. Saving the changes at this step will allow you to select the target locales from a list of valid locales in a drop-down box in the next step.
  5. In the Target Locales section, select the checkbox beside each target site language (not the source), and select the corresponding Smartling target language from the drop-downs.
  6. Click Save Changes to save the profile. 

Configure Smartling Plugin - Expert Settings

While creating or editing a profile, you can access an extended set of settings by clicking Show Expert Settings at the bottom of the profile page. Contact Technical Support or your Customer Success Manager before modifying these settings.

Updates to these settings will change how content is handled during the translation process. Please consult before making any changes.

Field Options and Explanations
Upload Options:
Resubmit changed content Automatically: The Connector resubmits content to Smartling whenever a change in original content is detected.

Manually: You must resubmit original content when it changes.
Force sync attachment files on upload Disabled: The connector synchronizes attachments from source to target sites only once when they are submitted the first time. This allows you to add localized images later and the connector will not override these manual changes.

Enabled: Every time attachments are submitted to Smartling they will synchronize from source to target sites. This would work well when you want all images on the target site to be replaced, for example, if all icons have been redesigned. If you resubmit attachments with this option enabled, all target site icons will be overwritten.
Auto Authorize Checked (default): Strings are authorized for translation in Smartling automatically.

Cleared: You must go to the Smartling dashboard and authorize strings for translation. When you manually authorize strings, authorize only for the locales list set up for submitting with the connector. Languages that are not on the locales list will not be tracked or retrieved.
Download Options:
Retrieval Type Pseudo: Smartling can provide pseudo translations, which is the original strings with extra characters added to increase the length by 30 percent (default). This emulates the increase in length that can occur when strings are translated, allowing you to test the expanded text before translation is completed.

Published: Only completed translations will be retrieved.
Download translated files when Translation Completed: Translations will be downloaded when they reach the Published step in a workflow.

Progress Changes: Translations will be downloaded when the connector finds that a translation in a file has been added or changed
Publish completed translation No: Post status is not affected when translations are downloaded.

Yes: Post status is set to Published after download of completed translations.
Auto synchronize properties on translated page with source

Disabled: Third-party plugins can add/remove properties for a page (these are stored in the wp_postmeta table). The default behavior is to translate all values from the wp_postmeta table and save translations for target sites. If the third-party plugin removes some properties between submits to Smartling, the removed properties will not be synchronized by the connector. This is important only if the plugin/theme depends on the changed properties.

Enabled: The connector synchronizes properties by:

  • removing all properties from wp_postmeta table of target site
  • copying all properties from source to target site
  • overwriting properties of target site with translations
Exclude fields by field name 

Fields listed will be excluded when the post is sent to Smartling for translation, and will not appear in the translations returned to WordPress. This is useful for elements that only need to exist on the source page, like post dates, comments, or comment counts.

Example:
post_modified term_group

Copy fields by field name 

Fields listed here will be copied from the source to the target locale. No translation will take place. The translated content will be the same as the source content. 

Example:
comment_status effective_date mime-type

Copy by field value

Fields that match the regular expressions listed here will be copied from the source to the target locale. No translation will take place. The translated content will be the same as the source content. This allows you to capture multiple fields using expressions instead of entering every field name in the Copy fields by field name box.

Examples:
^\d+([,\.]\d+)?$ ^(http:|https:|field_) ^(taxonomy|category|\s+)$

SEO fields by field name  Field names listed here will be flagged as SEO (search engine optimization) terms in Smartling, identifying them with a special translation key so they can be translated appropriately. 

 

Configure WP Cron

The WordPress Connector uses WP-Cron to run regular tasks. See here for further information about hooking WP-Cron into the system task scheduler.

  1. Ensure that the domain name of your WordPress site is resolved on the server by pinging it when you’re logged in via ssh. for example:
    ping mywordpressinstallation.com

    If you get a response like "Could not resolve host: mywordpressinstallation.com", then you will need to add a record to your /etc/hosts file

  2. To configure a Cron task, edit your crontab (using the appropriate user nginx\ www-data):
    sudo -u nginx crontab -e

  3. Add a line to the end of the file:
    */5 * * * * curl http://mywordpressinstallation.com/wp-cron.php > /dev/null 2>&1
    OR
    */5 * * * * wget -O - -q -t 1 http://mywordpressinstallation.com/wp-cron.php

    This will run WordPress cron every 5 minutes. Remember to leave at least one blank line at the end of the file.

  4. Edit your wp-config.php file and add the following line:
    define('DISABLE_WP_CRON', true);</code
Was this article helpful?