Skip to content

How to add new language dynamically #430

@camohub

Description

@camohub

Hi there,
can somebody tell me please how to achieve this.
I need to add new language to the app dynamically.
There is config/translatable.php which contains

    'locales' => ['en', 'cs', 'cz', 'sk', 'pl',  'de', 'hu',  'uk',  'us', 'gb', ],

This does not allow to add new language which is not defined in this array. I have a controller which want to add new languages and tries to do it this way.

        config([
            'translatable.locales'         => $newLocales,
            'translatable.locale'          => $data['default_language'],
            'translatable.fallback_locale' => $data['default_language'],
        ]);

I thought this will cange the config and library will add new language. But the library allow only the languages which are in config file array.
How can I dynamically add new languages to the application?
Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions