Universeorange.com/Docs/

R3m/framework Function reference import.translation

{import.translation()}

{import.translation()} — Import the translation file.

The translation root file is in:

"<project_dir>/Host/<subdomain>/<domain>/<extension>/Data/Translation.json"
"<project_dir>/Data/Translation.json" 

The translation file can have resources:

{
    "main" : {
        resource : "{$urlMain}"
    },
    "book" : {
        resource : "{$urlBook}"
    }
}

An example of a translation file:

{ 
    "route" : {
        "index" : {
            "en" : "{route.get('index', ['en'])}",
            "nl" : "{route.get('index', ['nl'])}"
    }
}

Before you can use {__()}, {import.translation()} needs to be loaded first.

Example:

{import.translation()}
{$route = __('route.index')} // https://example.com/en/index.html
{session('language', 'nl')} // default language is 'en'
{$route = __('route.index')} // https://example.com/nl/index.html
Last modified: 2021-06-07

© 2021 universeorange.com