Prepare translation for add-on

Developer
Depuis Poland
Membre depuis 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
Depuis Sweden
Membre depuis mai 2013
tim

Not really, no :( I recommend a CSV.

LiteCart Fan
Depuis Poland
Membre depuis août 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
Depuis Sweden
Membre depuis mai 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?

Ce fil de discussion a été fermé en raison d'une longue inactivité. Il n'est pas possible de publier dessus.
Ce site n'utilise aucun cookie ni aucune technologie de suivi tierce. Nous pensons pouvoir faire mieux que les autres et nous nous soucions vraiment de votre vie privée.