Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines
You do this:
use \koolreport\dashboard\languages\PTBR;
class App extends Application
{
protected function onCreated()
{
$this->language(
PTBR::create()
->extra([
"Customer"=>"Customer in PT language",
...
])
);
}
}
You can create your own class if you want:
class MyPT extends PTBR
{
protected function onCreated()
{
$this->extra([
"Customer"=>"Customer in PT language"
...
]);
}
}
then you set in App: $this->language(MyPT::create());
The language in version 4.x of dashboard is different from 3.x. The previous 3.x language use trait to set language but 4.x use class to provide more flexibility in settings and wider range of usecase.
Tryed to comment EN and languages() but Lang::t('Back') stopped working and is printing just "Back".
// use \koolreport\dashboard\languages\EN;
use \koolreport\dashboard\languages\PTBR;
class App extends Application
{
/*protected function languages()
{
return [
PTBR::create(),
EN::create(),
];
}*/
I know, why use Lang if I will only use PTBR?
If I can let it PTBR only I will probably not need to translate all the rest to EN too. But I'm not sure and, if possible, I want to let all prepared to easy switch to multilanguage if needed.
I guess I got it, I may use
Lang::t('Cliente') // In ptbr
and, If needed I can extend EN to translate from PTBR to EN like in
class MyEN extends EN
{
protected function onCreated()
{
$this->extra([
'Cliente' => 'Customer',
]);
}
}
Am I right? I'm not sure it's the best way.
Yes, it is seems the best way, you use the PTBR as default so that all the English framework text like "Back" is translated to your PT. When you change to MyEN, the default text like "Back" will not be translated (so it is correct in English), but those text in PT like "Cliente" will be translated to "Customer".
Another suggestion:
Since our framework default language is EN, all default text are EN. So in your app, you use PTBR as language, and provide the extra translation like "Customer"=>"Cliente".
In your app, anywhere that you need to output something in PTBR, you do:
Lang::t("Content in English")
And in your translation PTBR, you add:
"Content in English"=>"Content in PTBR"
It is also a good solution.
Let KoolReport help you to make great reports. It's free & open-source released under MIT license.
Download KoolReport View demo