Language Packs: Dynamic Content

Previous Section: Language Files


A fresh installation of SupportPal includes a number of strings in English, such as status names and email templates. This default data can be translated by seeding in to the database.

This code should be placed in the activate function. It is called every time the language pack is activated. We can use the installedVersion helper to ensure we only seed this data on the first activation (in case it is deactivated and then activated again in the future).

Below is an example of translating the 'Open' status to Spanish.


    /**
     * Languages can run an installation routine when they are activated. This will typically include adding default
     * values, initialising database tables and so on.
     *
     * @return boolean
     */
    public function activate()
    {
        // First install only.
        if ($this->installedVersion() !== null) {
            return true;
        }

        // Translate 'Open' status.
        \DB::table('ticket_status_translation')->insertOrIgnore([
            'status_id' => 1,
            'name'      => 'Abierto',
            'locale'    => 'es',
        ]);

        return true;
    }

Our included Spanish language pack has a complete set of seeds for translating the default data.

Other dynamic content that is created or modified after the installation, such as articles, can be translated through the interface after the language has been activated - find out more at Multilingual Content.


Next Section: Upgrading