• Welcome to WebsiteBaker Community Forum. Please log in or sign up.
Welcome, Guest
News
Support WebsiteBaker
Your donations will help to:
PayPal
  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!
You can donate by clicking on the button below.

Wie Sprachdateien bei einer Modul-Programmierung korrekt einbinden?

Started by masju, September 30, 2026, 07:35:17 PM  ( Read 429 times )

masju

Hallo zusammen,

ich tüftle gerade ein neues Modul zusammen und frage mich, wie ich die Backend-Sprachdateien korrekt einbinde. Im aktuellen form-Modul steht (modify.php):
Code Auswählen
/* ----------set to deprecated----------------------------- */
// load module language file
   if (is_readable($sAddonPath.'languages/EN.php')) {require($sAddonPath.'languages/EN.php');}
   if (is_readable($sAddonPath.'languages/'.DEFAULT_LANGUAGE.'.php')) {require($sAddonPath.'languages/'.DEFAULT_LANGUAGE.'.php');}
   if (is_readable($sAddonPath.'languages/'.LANGUAGE.'.php')) {require($sAddonPath.'languages/'.LANGUAGE.'.php');}

Das ist easy aber bereits als "deprecated" gekennzeichnet. Wie mache ich das also WB-konform und zukunftssicher?

Viele Grüße
masju

    crnogorac081

    Try this
    $oTrans->enableAddon('modules\\\\'.$sAddonName)

    Quote from: masju on September 30, 2026, 07:35:17 PMHallo zusammen,

    ich tüftle gerade ein neues Modul zusammen und frage mich, wie ich die Backend-Sprachdateien korrekt einbinde. Im aktuellen form-Modul steht (modify.php):
    Code Auswählen
    /* ----------set to deprecated----------------------------- */
    // load module language file
      if (is_readable($sAddonPath.'languages/EN.php')) {require($sAddonPath.'languages/EN.php');}
      if (is_readable($sAddonPath.'languages/'.DEFAULT_LANGUAGE.'.php')) {require($sAddonPath.'languages/'.DEFAULT_LANGUAGE.'.php');}
      if (is_readable($sAddonPath.'languages/'.LANGUAGE.'.php')) {require($sAddonPath.'languages/'.LANGUAGE.'.php');}

    Das ist easy aber bereits als "deprecated" gekennzeichnet. Wie mache ich das also WB-konform und zukunftssicher?

    Viele Grüße
    masju
      Web developer

      masju

      Quote from: crnogorac081 on October 01, 2026, 08:03:47 AMTry this
      $oTrans->enableAddon('modules\\\\'.$sAddonName)

      Thank you very much. Is there any documentation or module that uses this code so I can see an example?

        crnogorac081

        Check in modules that comes with default instalation

        Quote from: masju on October 01, 2026, 09:13:32 AM
        Quote from: crnogorac081 on October 01, 2026, 08:03:47 AMTry this
        $oTrans->enableAddon('modules\\\\'.$sAddonName)

        Thank you very much. Is there any documentation or module that uses this code so I can see an example?

          Web developer

          dbs

          Here's a question for you: What's the point of quoting each other in every direct reply?  :? :-o

            crnogorac081

            Web developer

            dbs

            Thx, important information. i don't knew it.
            will be fixed in short time.

              \n\n