KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

DrillDown back button not using languages #2800

Open GHSix opened this topic on on Aug 19, 2022 - 10 comments

GHSix commented on Aug 19, 2022

At App.php I have

use \koolreport\dashboard\languages\PT_BR;

and it is working well in the Dashboard.

In the translation we also have:

"Back"=>"Voltar",

But DrillDown back button is showing as "Back".

Is this a bug or for Drilldown I need to take further steps to use languages?

KoolReport commented on Aug 20, 2022

You try this to see how:

"btnBack"=>["text"=>"My Button"]

Let me know if it works.

GHSix commented on Aug 20, 2022

Here in the docs is the only place I found showing how to use "btnBack" and it gives me the error:

Message: Illegal offset type
Line: 236
File: /www/dev/koolreport/vendor/koolreport/dashboard/Dashboard.php

Doubting this button config is a cssClass stuff, I tried it in other places too but can't find where to add this.

But, even when I find where to add this config, the suggestion let me to believe that DrillDown will not use the translation already provided and it seems a bug.

KoolReport commented on Aug 20, 2022

No, this should be the one: properties

Basically you do:

DrillDown::create([
    ...
        "btnBack"=>["text"=>"My Button"]
    ...
]
KoolReport commented on Aug 20, 2022

Sorry, I forgot that you use Dashboard, it should be this:

protected function onCreated()
{
    $this->settings([
        "btnBack"=>["text"=>"Voltar"]
    ]);
}
GHSix commented on Aug 20, 2022

That one was the first thing I tried, but gives the same error.

 protected function widgets()
    {
...
Panel::create()
                ->sub([
                    MainAvbValDrill::create([
                        "btnBack"=>["text"=>"My Button"]
                    ])->lazyLoading(true),
                ])
...
KoolReport commented on Aug 20, 2022

You do this:

class MainAvbValDrill extends DrillDown
{
    protected function onCreated()
    {
        $this->settings([
            "btnBack"=>["text"=>"Voltar"]
        ]);
    }
}

And do:

Panel::create()
                ->sub([
                    MainAvbValDrill::create()->lazyLoading(true),
                ])
GHSix commented on Aug 20, 2022

Oh, I tried btnBack as a props but not inside settings props.

It is translated now. Thank you.

KoolReport commented on Aug 20, 2022

That's great!

GHSix commented on Aug 20, 2022

But I still believe it should be marked as a bug because it's not using the given translation.

While I want it translated to only 1 language it's kind of ok to use btnBack settings, but when I want 2 or more translation it will be a pain to need to do that.

As a quick fix, I may suggest to change the text inside the button to a single back arrow icon. It will be an universal "back" indication.

'btnBack' => ['text'=>'<i class="fa fa-arrow-circle-left"></i>']
KoolReport commented on Aug 22, 2022

Agree that the translation should apply anywhere that it could. I will marked your topic as suggestion for dev.team to further improve.

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed

Dashboard