Add possibility to `alter` filename before saving it into database. This approach requires an implementation of the hook on the client side but it will allow them to implement filename pattern that they want to have.

Possible example:

/**
 * Alter translation file name.
 *
 * @param string $name
 * @param JobInterface $job
 */
function hook_tmgmt_smartling_filename_alter(&$name, JobInterface $job) {
  // Example: filename = job's label. If you have only one job item in a job
  // then file name will look like "[node_title]_job_id_[id]". If there are more
  // than 1 job item inside a job then filename will look like
  // "[node_title]_and_[n]_more_job_id_[id]". If you enter your own job label
  // then filename will look like "[your_own_label]_job_id_[id]"
  $name = preg_replace('/[^a-zA-Z0-9_\-\:]/i', '_', $job->label()) . '_job_id_' . $job->id();
}

Comments

Loparev created an issue. See original summary.

loparev’s picture

loparev’s picture

Status: Needs review » Fixed

  • Loparev committed ce03fb3 on 8.x-2.x
    Issue #2921534 by Loparev: Provide possibillity to alter filename
    

Status: Fixed » Closed (fixed)

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