Drupal 7 Classic Connector

Changeable Source Locale functionality in Drupal 7

Use Cases

  • You want to publish foreign-language translations before the English-language source can be published.
  • You want to translate content not from the Drupal's source locale (for example, you have us and us-metric locale which is the same as us but with metric measurements, and you want translations to have metric measurements as well)

How it works

  • Go to the Smartling settings page `/admin/config/regional/smartling`
  • Go to Advance Settings
  • Select needed Smartling source locale and save.

How to prepare existing content

If you used 'by nodes' translation method:

  1. Add “new needed locale” language translations for needed nodes. Example: let’s say you have next nodes: “Test node” (en, nid = 1, tnid = 1) and “Test node FR translation” (fr, nid = 2, tnid= 1). So you need to add “Test node source” (ghost, nid = 3, tnid = 1)
  2. Make them “source” nodes. Example: update `tnid` node property for needed node. In this case values should be:
    “Test node”, en, nid = 1, tnid = 3 (instead of 1)
    “Test node FR translation”, fr, nid = 2, tnid = 3 (instead of 1)
    “Test node source”, ghost, nid = 3, tnid = 3 (instead of 1)
    So for now node with nid = 3 is a source node for others in this set.
  3. Fix next values for needed nodes in `smartling_entity_data` table (Smartling connector works with `smartling entity data` entities which are submissions. They contain information about related node, source language, target language etc.):
    • Change `rid` (related entity id) value to new “source” node `nid`. Example: you have a submission with id = 1 and rid = 1 (“Test node”) for fr language. Change rid to 3 (“Test node source”)
    • Change `original_language` value to selected “Smartling source language”. Example: should be langcode of “new needed locale” language.
    • Remove `file_name` and `translated_file_name` values in order to let the connector generate new filenames with new `nid` in the name. Example: submission with id = 1 has `file_name` = “test_node_1.xml” and `translated_file_name` = “test_node_fr_1.xml”. Set their values to “” (empty string). Next time when you will upload/download this submission these names will contain nid of new source node (“Test node source”, nid = 3).

If you used 'by fields' translation method:

  1. Change language of the source node to the “new needed locale” language.
  2. Fix next values for needed nodes in `smartling_entity_data` table:
    • Change `original_language` value to selected “Smartling source language”.

The Drupal Connector will be authorized to send both old and new content to Smartling from a specified source language that is not the site's default language.

Additionally, the callback url is changed (which is used for automatic translation download right when it’s done in Smartling). it will look like: /[language_prefix]/smartling/callback/[token] where [language_prefix] is a prefix which is set up in language settings page):

Please note that this will work only with path language prefixes but not with domain language.

 

Was this article helpful?