Jump to content

Add page only to one language


DevTomas
 Share

Recommended Posts

For example I have 2 languages: English and Russian and want add page News only to English language. When I create page I set title only in English, but when preview page I got 2 same pages in both languages. My question is, how to create page for one language ? 

Link to comment
Share on other sites

There are a few different ways to approach a multi-language website. The answer will depend on what multi-language solution are you using. If you are using the multi-language page names module native to PW 2.3, then you would have checkboxes on your settings tab that indicate whether the language is active or not. However, since you mentioned you have 2 different pages, I'm guessing you are using some other multi-language solution, but not sure which?

Link to comment
Share on other sites

  • 5 months later...

Hello,

I'm new in this forum. First I want to thanks a lot the processwire community and Ryan for this wonderful tool and all these explanations! (sorry if it's a "french english"...)

So, about this topic, with the multi-language page name module approach, I know there is a checkbox for each language but not for the default.

All is fine when you don't want to translate the initial default language page. I understand that the default language should exist to support the other(s).

But how to do when I want to add a new page with only a secondary language enabled ? My project will have most of his pages translated (french for the default language and english) but if my client want to add a specific page only in english is it possible?

Thanks for your help.

Link to comment
Share on other sites

Bienvenu au forum icietla :)

There are probably many workarounds for that scenario. You could create a checkbox inputfield, and check the value in your head or init.php template. If that checkbox is checked, you could do a redirect to the other language.

if($page->redirectLang == 1) {
    $user->language = "en";
    $session->redirect($page->url);
} 

(untested)

  • Like 4
Link to comment
Share on other sites

Merci Dragan !  :)

Your solution seems great! Because I don't have a long processwire experience, I did not think about it : how powerful (and simple) it is to add any field in any template we want for any need... I will try it. Thanks a lot.

  • Like 1
Link to comment
Share on other sites

  • 3 months later...

If you are using the multi-language page names module native to PW 2.3, then you would have checkboxes on your settings tab that indicate whether the language is active or not.

I just stumbled upon this catching up on my reading for multi-language sites. For a long-term multi-lang project I'm about to implement, this is pretty much perfect.

One of the (many) cases where I stumble upon something implemented in PW, and I just go “Wow, Ryan, that's a brillant solution.” It really gives me a warm, fuzzy feeling that this CMS is being developed the way it makes sense.

Just wanted to note that, even if it's way after the fact.  :)

Link to comment
Share on other sites

  • 3 months later...

Bienvenu au forum icietla :)

There are probably many workarounds for that scenario. You could create a checkbox inputfield, and check the value in your head or init.php template. If that checkbox is checked, you could do a redirect to the other language.

if($page->redirectLang == 1) {
    $user->language = "en";
    $session->redirect($page->url);
} 

Hey folks,

This one is nice dragan, thanks for sharing!

Is there a way of disabling language pagenames for some templates?

I'm thinking of an image template where i don't want/need different urls.

Or of course it would be cool if it where possible to disable not only the additional languages but the default as well.

And one more question. Is it somehow possible to have language urls checkbox disabled by default?

So I have to activate it myself when I'm going to publish another language version instead of having to uncheck it..?

Cheers

Link to comment
Share on other sites

  • 7 months later...

I share the same need as Can and icietla: the hability to disable the main language of any given page in order to exclude it from listings and access. For the time being, it is only possible to disable for non-default languages.

  • Like 1
Link to comment
Share on other sites

  • 2 months later...

I think I found another simple approach to this topic. 

Just add a specific word to your page title (only for the default language). 

Let's say your page is called "Regional Products". You can add the word "french" for example and name it "Regional Products (french)".

The french Multi-Language-Title can still be translated to ›Produits régionaux‹, without any additions.

Now you are able to filter your listings with the Selectors API. And find all pages which doesn't contain your specific word in the default-language title. 

!title*='french'

If you are using the nice module MarkupSimpleNavigation the options setting looks like this:

$options = array(                              
   // selector: page-filter for default lang, if word is contained in page-title
   "selector" => "!title*='french'"
);

The result is the specific pages are filtered within the default language and they are still listed for the 'activated' languages under the Settings-Tab.

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...