Right now tmgmt_smartling uses XLIFF format to upload content for translation to Smartling and download it back. But XLIFF somewhat limited support for HTML on Smartling side. So it is better to use XML format instead.

Comments

Soul88 created an issue. See original summary.

loparev’s picture

  1. +++ b/src/Plugin/tmgmt/Translator/SmartlingTranslator.php
    @@ -155,7 +157,7 @@ class SmartlingTranslator extends TranslatorPluginBase implements ContainerFacto
    +          'xml',
    

    We need to think how to get rid of hardcoded file extension

  2. +++ b/src/Plugin/tmgmt/Translator/SmartlingTranslator.php
    @@ -258,7 +260,7 @@ class SmartlingTranslator extends TranslatorPluginBase implements ContainerFacto
    +    return  "JobID" . $job->id() . '_' . $job->getSourceLangcode() . '_' . $job->getTargetLangcode() . '.xml';// . $job->getSetting('export_format');
    

    Remove redudnant comment. Also we need to think how to get rid of hardcoded file extension.

  3. +++ b/src/Plugin/tmgmt/Translator/SmartlingTranslator.php
    @@ -323,4 +325,19 @@ class SmartlingTranslator extends TranslatorPluginBase implements ContainerFacto
    +    $data = str_replace('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">', $smartling_derictives, $data);
    

    Possible problem: if theme debugging is enabled then generated xml is incorrect. Because of <!-- THEME DEBUG --> strings BEFORE <?xml version="1.0" encoding="UTF-8"?> string which is incorrect for xml. We need to think how to handle it.

  4. +++ b/src/Plugin/tmgmt/Translator/SmartlingTranslator.php
    @@ -323,4 +325,19 @@ class SmartlingTranslator extends TranslatorPluginBase implements ContainerFacto
    \ No newline at end of file
    

    Please add EOL here.

  5. +++ b/tmgmt_smartling.module
    @@ -31,7 +31,7 @@ function tmgmt_smartling_download_file(\Drupal\tmgmt\JobInterface $job) {
    +    $extension = 'html';//pathinfo($file->getFileUri(), PATHINFO_EXTENSION);
    

    Remove comment. Plus again hardcoded file extension.

loparev’s picture

+++ b/src/Plugin/tmgmt/Translator/SmartlingTranslator.php
@@ -323,4 +325,19 @@ class SmartlingTranslator extends TranslatorPluginBase implements ContainerFacto
+<!-- smartling.placeholder_format_custom = (@|%|!)[\w-]+ -->

Hardcoded pattern should be taken from translator settings

soul88’s picture

StatusFileSize
new4.46 KB

Just another patch.

loparev’s picture

Looks good for me.

soul88’s picture

Status: Active » Needs review
StatusFileSize
new5.54 KB

Final version.

soul88’s picture

StatusFileSize
new6.26 KB

  • Soul88 committed 04b8dcb on 8.x-1.x
    Allow users to submit content either in XML or in XLIFF format. XML is...
soul88’s picture

Status: Needs review » Fixed
loparev’s picture

StatusFileSize
new7.02 KB
loparev’s picture

Status: Fixed » Needs review
loparev’s picture

StatusFileSize
new6.1 KB
new2.87 KB
loparev’s picture

Please not that you need rebuild cache first and then run updates.

loparev’s picture

  • Loparev committed 9bfddf5 on 8.x-1.x authored by Soul88
    Issue #2864481 by Loparev, Soul88: Switch connector to use XML format as...
soul88’s picture

Status: Needs review » Fixed

  • Soul88 committed 04b8dcb on 8.x-2.x
    Allow users to submit content either in XML or in XLIFF format. XML is...
  • Loparev committed 9bfddf5 on 8.x-2.x authored by Soul88
    Issue #2864481 by Loparev, Soul88: Switch connector to use XML format as...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.