Language Files

Contents

Language Structure

Translatable content locations

resources/lang

Primarily language strings are stored in files within the resources/lang directory, which each subdirectory representing a language supported by the application.


    /resources
        /lang
            /en
                core.php
            /es
                core.php
Plugins

Language strings can also be defined in plugins, for example within items in the app/Plugins, app/Widgets and app/Modules/Ticket/Channels folders. Find out more about plugin language files.

Multilingual Input Fields

When you install SupportPal, the database is seeded with default ticket statuses, departments and other data so that the product is ready to use immediately, it is all seeded in English. The seed data (and your own other dynamic content) can be translated into other languages using Multilingual Content.

Naming convention

The name of the directory must conform to BCP 47 using a ISO_639-1 locale code and an optional ISO_3166-1 ALPHA-2 regional identifier. For example, valid identifiers are: 'en', 'es', 'en-GB', 'en-US'.

File structure

Each language files must return an array of language strings:


    <?php

    return [
        'product_name' => 'SupportPal',
    ];

Using Translations

Language strings can be accessed from any part of the application using Lang::get() function. If you need to access language files from within a template the syntax changes slightly to Lang.get(). For example, if you would like to access the product_name language string in the core.php file from within a PHP file:


    echo Lang::get('core.product_name');

Alternatively, from within a template file:


    {{ Lang.get('core.product_name') }}

Variable Replacement

If you need to dynamically control words within language strings, this is possible using placeholders. All placeholders are prefixed by the : character.


    <?php

    return [
        'product_name' => 'SupportPal,
        'welcome'      => 'Welcome to :product_name',
    ];

We can then assign the placeholder value when accessing the language string:


    echo Lang::get('core.welcome', [ 'product_name' => Lang::get('core.product_name') ]); // Welcome to SupportPal

Pluralisation

Often we make use of singular and plural forms of language strings. Pluralisation is possible via the pipe (|) character:


    <?php

    return [
        'product' => 'Product|Products'
    ];

Depending on whether we want to access the singular of plural form, the string can be accessed using the Lang::choice() function. The second parameter specifies which form we would like to retrieve:


    echo Lang::choice('core.product', 1); // Product
    echo Lang::choice('core.product', 2); // Products

Available Language Packs

Official Language Packs

These translations are available within the product and are maintained by SupportPal Limited.

English (United Kingdom) is enabled by default. Other languages can be enabled by browsing to Settings > Languages in the operator panel.

Community Language Packs

To install a community translation:

  1. Click the Download link below for your selected translation
  2. Remove language-files- from the containing directory name. For example, language-files-de would become de
  3. Upload the directory to the resources/lang/ directory within your SupportPal installation
  4. Visit Settings > Languages in the operator panel and enable the new language.

Language Source Download Link
Portuguese (Brazilian) GitHub Repository Download
Dutch GitHub Repository Download
French GitHub Repository Download
German GitHub Repository Download
Persian GitHub Repository Download
Russian GitHub Repository Download
Swedish GitHub Repository Download
Turkish GitHub Repository Download

Contributing Languages

To contribute your own language files, please create a pull request to the language files repository, or alternatively open a ticket with us attached with the files and we will place them in the repository.

We really appreciate your contributions! Existing languages may also require updating to the latest version, for which we would appreciate contributions too.