This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Andreas Kosmowicz
Andreas Kosmowicz

Hi, I am developing a bilingual Website by now (DE and EN, with standard on DE).

For this I am developing some plugins that use the Lang::get() command.

It works well using the prefix in the URL /de/ or /en/. Also the site works with the Translate Plugin and the Language Picker, reliably.

BUT, there is this one Problem in my Plugin:

Having not set the URL-Prefix as above my output (generated in the Component with Lang::get()) shows up in English first. Then, when I use the URL with /de/ Prefix it runs in german. When I, eventually remove the prefix, it stays in German. But once the Frontendsession has become obsolete (I guess) the form shows up in English. And it really shouldn't. (Backend setting for default language as DE is made).

In the component I use the following code:

<?php ...
use Lang;
...
class AddEvent extends Component Base {
public function formElements() {...
    return [
    ...
   "label"         => Lang::get("kosmoskosmos.forms::lang.forms.event_submission_type"),
    ...];}

The Template now calls this method directly:

{% partial "@form.htm" items=__SELF__.formElements() properties=__SELF__.properties() %}

Anyone has a clue where to look? Is this a general problem to be fixed or am I doing something wrong? Anyone, first?

Thanks a lot, Andreas

Renatio
Renatio

Did you change default language in application config file? (config/app.php)

Andreas Kosmowicz
Andreas Kosmowicz

Hi Renatio,

that seems to work. Thank you.

Tried this in my local test env, but forgot to change the value in the staging env...

1-3 of 3

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.