Jump to content

Page in non-default language only - can it be done without separate trees?


The G
 Share

Recommended Posts

Hello everyone :-*,

I searched the forums, but could not find any simple way to take the default language out of one page (or a few pages), like this

Homepage

    en

        page1

        page2

    de

        seite1 (page1 content translated in German)

        seite2 (page2 content translated in German)

        seite4 (only in German, no English version - this is what I don't know to do)

The way it is now, the default language cannot be disabled, so "seite4" would have the English translation fields in the editing form and would render in the front end.

I thought about creating a second English (en) language and hiding the default one, but it won't work because the way ProcessWire treats the "name" field.

Another way would be separate trees for each language. That would work for languages with content that is different enough. But for one or a few pages that would not be translated to the default language, I would loose the integrated interface and big image would become more difficult to see. So I'd much prefer not to use it.

The last way that crossed my mind was to modify the LanguageSupportPageNames module to update behind the curtain the default language with something while keeping it hidden. That's probably what I'll try given enough time.

What do you say? What do I miss?

 

LATER EDIT: I totally don't know any German, used it just as an example.

Link to comment
Share on other sites

Hi, probably I'm missing something about your request...

Quote

...would have the English translation fields in the editing form and would render in the front end.

Why should it render in the front end if there are no filled (english) fields? You could just check if a field is empty or not.

By the way, check out this module by @adrian, it could be useful in your situation:

https://processwire.com/talk/topic/14891-restrict-multi-language-branch/

Link to comment
Share on other sites

My bad, i should've not added that render comment. Sure, I could check the fields to see if they are empty and a 404 is needed. The other languages don't need this check, though. They can be disabled and that's enough.

My real question is about the editing interface: how can I hide the default language fields?

Thanks for the link to Adrian's module. Unfortunately, as I said in the first post, I'd very much prefer not to separate the translation interface for all pages just because a few of them might not use a language. Also, it appears that the request Adrian made for hooking the Languages class remained unanswered and so, his module cannot currently select the supported languages - it's all or default only.

IMO, the dificulty springs from the fact that the "name" and "title" mandatory fields are being used as translations. I'd rather duplicate "default" as  English and treat "name" as an ID, but then again, Ryan knows much better than me.

Link to comment
Share on other sites

Ad far as Il know it's not natively possibile to hide the default language fields from the backend, but you can can leave them empty and check (inside a foreach loop or whatever) if a default field of your choice in empty and then not render that page at all (a 404 would be invoked only if a user is going to switch the language on that particular pages, but you could instead redirect them, let's say, to the homepage.

Probably not what you asked exactly but nothing else comes into my mind right now:)

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