Jump to content

Deactivate / disable default language


DV-JF
 Share

Recommended Posts

Hi,

is it possible to deactivate the default language. I've setup a multi-language-site (default=de / en / si / hr / ru ) with a blog system. Some of the news articles will be translated to all languages, some will be only available in specific languages. Therefore I've used the build in function to activate or deactivate the pages under the settings tab.

Everything's working fine but now I need to not dispay an article in default=de language? How would you solve this problem?

Many greets...

Link to comment
Share on other sites

Hi @DV-JF

It's not possible to deactivate the default language in PW.

You can create custom inputs (checkboxes) to enable/disable specific language for page and then in your template check whether this page is viewable for this language and if not throw 404. 

In that way, you will rely on custom inputs for languages, so default language checkboxes should be checked for languages. You can use this hook for that

$wire->addHookAfter('Pages::added', function($event) {
  $page = $event->arguments(0);
  foreach ($this->wire->languages as $lang) $page->set("status$lang", 1);
  $page->save();
});

One drawback that I'm thinking about is that in your find() methods you have also check if this page viewable for this language. 

This is not tested but may work. 

Also, take a look at this module, you may find it useful in some cases

 

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...