Loading...

Localisation

The AuthStack frontend makes use of localisation and language files, allowing customisation on a per-region basis.

When the user loads any of the frontend templates, AuthStack will attempt to detect the locale of the browser and then automatically render the correct language. If a locale cannot be detected it will fall back to the default locale.

To enable localisation, change the following flag within /config/localization.php from false to true:

<?php
return [
    /*
    |--------------------------------------------------------------------------
    | Enables localization support
    |--------------------------------------------------------------------------
    |
    | If localization is enabled, translation files can be used
    | for custom translations for frontend website.
    |
    | Default theme doesn't use any translations
    |
    */
    'enabled' => false,

There are further commented options within the config file for review.

Language strings are stored within the following directory. Create your own by copying en and renaming as appropriate.

/resources
    /lang
        /en
            messages.php
        /de
            messages.php

All language files simply return an array of keyed strings. For example:

<?php

return [
    'welcome' => 'Welcome to our application'
];

You may configure a fallback language, which will be used when the active language does not contain a given translation string. Like the default language, the fallback language is also configured in the config/app.php configuration file:

'fallback_locale' => 'en',

AuthStack uses Laravel Localisation methods, therefore all localisation functions are available within themes you create.

Read more about Laravel Localisation


Previous Article

Theming

We're happy to talk

Our offices are open 8.30am - 7pm GMT, Monday to Friday - but you can always contact us via email. When we receive your email during opening hours, we aim to respond within 30 minutes or less. Should your email reach us out of hours, we will contact you when the office re-opens.

You can contact us using live chat