Prepare translation for add-on

Developer
De Poland
Miembro desde oct. 2014

Is there a way to prepare translation to add-on that is automatically added to database after files upload to ftp (bypassing csv import)?

tim
Founder
De Sweden
Miembro desde may. 2013
tim

Not really, no :( I recommend a CSV.

LiteCart Fan
De Poland
Miembro desde ago. 2018

This is not exactly what you asked but I'm doing something like that in my add-on


  {
    language::translate(__CLASS__ . ':not_selected', 'You need to select a destination locker');
    $this->set_translation('pl', __CLASS__ . ":not_selected", 'Musisz wybrać docelowy paczkomat');
  }

  public function uninstall()
  {
    database::query(
      "delete from " . DB_TABLE_TRANSLATIONS . "
    where code like '%" . __CLASS__ . "%';"
    );
  }

  public function set_translation($language_code, $key, $text)
  {
    $check_column_query = database::query("SHOW COLUMNS FROM " . DB_TABLE_TRANSLATIONS . " where field = 'text_" . $language_code . "'");
    $check_column = database::fetch($check_column_query);
    if ($check_column) {
      database::query(
        "update " . DB_TABLE_TRANSLATIONS . "
          set `text_" . $language_code . "` = '" . $text . "',
          date_updated = '" . date('Y-m-d H:i:s') . "'
          where code = '" . $key . "';"
      );
    }
  }```
tim
Founder
De Sweden
Miembro desde may. 2013
tim

language::translate(CLASS.':yada_yada', '...') is something that is recognized by the translation scanner. Admin -> Translations -> Scan.

Why not instruct your client to scan the platform for new translations?

Este hilo se ha cerrado debido a una larga inactividad. No es posible publicar en él.
This website uses no cookies and no third party tracking technology. We think we can do better than others and really think about your privacy.