Jump to content

default language requirements


nico
 Share

Recommended Posts

Hi all,

We were trying to find a way to set up the following functionality and are not sure if we might have overlooked something, is it possible to:

- either create an entry with the title field being set in a secondary language only (keep default language tab for the required title field empty)
- or, make it possible to set any language (including the default language) active/inactive by using the checkboxes in the page settings (currently this only works for the secondary languages)?

The goal we are trying to achieve is to be able to sync/create new pages via the API from json-data and depending on which language the data origins from, it should only set the according tabs for the multi-language fields (including the required page title).

best,
Nico

Link to comment
Share on other sites

Hi @nico, welcome to the forums.

As far as I know you cannot use a secondary language page with disabled (inactive) default language page. The default language page is the fallback for empty but active secondary language pages. So you need to have the default page active to be able to use any of your installed additional language pages.

But syncing multi language pages via API and json-data should be possible. Do you (also) sync / create pages where you have both, the default language and at least one secondary language content finally stored in one PW-page? Or do you ATM only have pages with one language set, default OR secondary?

Link to comment
Share on other sites

1 hour ago, horst said:

Hi @nico, welcome to the forums.

As far as I know you cannot use a secondary language page with disabled (inactive) default language page. The default language page is the fallback for empty but active secondary language pages. So you need to have the default page active to be able to use any of your installed additional language pages.

But syncing multi language pages via API and json-data should be possible. Do you (also) sync / create pages where you have both, the default language and at least one secondary language content finally stored in one PW-page? Or do you ATM only have pages with one language set, default OR secondary?

Hi @horst, thanks for your reply!

Thanks for clarifying the need of an always active default language as fallback – as for the second part: I have exactly the problem, that the automatically synced multilanguage pages will each only have one language set, and if that language is not the default language that's where it gets messy because the page title cannot be set only for a secondary language. I've looked into a few workarounds (f.ex. additionally setting the language from the json in a checkbox or additional field, but write the actual contents into the default language fields instead.. but this would mean much more code/filtering on the frontend which I'm trying to avoid).

Link to comment
Share on other sites

17 minutes ago, nico said:

I have exactly the problem, that the automatically synced multilanguage pages will each only have one language set, and if that language is not the default language that's where it gets messy because the page title cannot be set only for a secondary language. I've looked into a few workarounds (f.ex. additionally setting the language from the json in a checkbox or additional field, but write the actual contents into the default language fields instead.. but this would mean much more code/filtering on the frontend which I'm trying to avoid).

If you really have in your final PW site pages that do have complete content for a secondary language, but an empty default language, you may try the following:

For the default language only populate the title field with a indicator string like "onlySecondary" or what you find useful here. Than populate all secondary language fields with your content and let all default ones empty. If this is possible, what it should be, if you not have flagged any fields as required, you can simply filter with one addition to your selectors, that exclude pages with the indicator string in the title field. SO also hacky, but maybe acceptable regarding of the format and amount of your content and languages.

$mySelector = 'YOUR PREVIOUS SELECTOR FOR PAGES HERE' . ', title!=onlySecondary';

The only field(s) every page (in default language) needs is the title field and the name field what gets auto created from the title field.

Edited by horst
added selector example
Link to comment
Share on other sites

Thanks for this @horst ! The workaround looks way cleaner than using additional fields or checkboxes. Additionally, we'll be setting the actual secondary language slug (f.ex. "en") instead of "onlySecondary" as default page title (for pages which only contain secondary language data) in order to pass on the specific language information.

Best,
-N.

  • Like 1
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...