You are here

public function boxes_i18n::locale_refresh in Boxes translation 7

Same name and namespace in other branches
  1. 6 plugins/boxes/boxes_i18n.inc \boxes_i18n::locale_refresh()

Refresh the translatable strings.

1 call to boxes_i18n::locale_refresh()
boxes_i18n::save in plugins/boxes/boxes_i18n.inc
Save a box.

File

plugins/boxes/boxes_i18n.inc, line 59

Class

boxes_i18n
Simple translatable custom text box.

Code

public function locale_refresh() {
  if ($this->options['i18n_boxes']['language'] == I18N_BOXES_LOCALIZE) {

    // Update the box's body field; if empty, remove the translation.
    if (!empty($this->options['body']['value'])) {
      i18n_string_update(array(
        'boxes',
        $this->plugin_key,
        $this->delta,
        'body',
      ), $this->options['body']['value'], array(
        'format' => $this->options['body']['format'],
      ));
    }
    else {
      i18n_string_remove(array(
        'boxes',
        $this->plugin_key,
        $this->delta,
        'body',
      ));
    }

    // Update the box's title field; if empty, remove the translation.
    if (!empty($this->title)) {
      i18n_string_update(array(
        'boxes',
        $this->plugin_key,
        $this->delta,
        'title',
      ), $this->title);
    }
    else {
      i18n_string_remove(array(
        'boxes',
        $this->plugin_key,
        $this->delta,
        'title',
      ));
    }
  }
  return TRUE;
}