Change a language / Other site packages might interrupt

Hello together,

it is me again :slight_smile:

I’m having like around 4 neos Site Packages that should be independed. But it seems like i’ve made a mistake, or probably something is not configured good enough.

My case right now:

Within my project, i’ve started to develop with a default language (english). I’ve created each node and filled it up with some content etc. Now i want to add a second language and even more: I want to make the second language as default language (polish).

For this i’ve changed my Settings.Language.yaml from:

Neos:
  Neos:
    userInterface:
      # Spot untranslated labels in the backend
      #scrambleTranslatedLabels: true
      defaultLanguage: 'en_US'
      translation:
        autoInclude:
          'Vendor.Neos': ['NodeTypes/*']
  Flow:
    i18n:
      defaultLocale: 'en_US'
      fallbackRule:
        order: ['en_US', 'pl']
  ContentRepository:
    contentDimensions:
      language:
        label: 'Language'
        icon: 'icon-language'
        # The default dimension that is applied when creating nodes without specifying a dimension
        # Crucially important are the default and defaultPreset keys: They define what language you get when visiting the root of the website; and when logging into the backend. So the default (2) must reference the value en_US, while the defaultPreset (3) must reference the preset en.
        default: 'en_US'
        # The default preset to use if no URI segment was given when resolving languages in the router
        defaultPreset: 'en'
        presets:
          en_US:
            label: 'English (US)'
            values:
              - en_US
            uriSegment: ''
          pl:
            label: 'Polish (PL)'
            values:
              - pl
            uriSegment: 'pl'

To:

Neos:
  Neos:
    userInterface:
      # Spot untranslated labels in the backend
      #scrambleTranslatedLabels: true
      defaultLanguage: 'pl'
      translation:
        autoInclude:
          'Vendor.Neos': ['NodeTypes/*']
  Flow:
    i18n:
      defaultLocale: 'pl'
      fallbackRule:
        order: ['pl', 'en_US']
  ContentRepository:
    contentDimensions:
      language:
        label: 'Language'
        icon: 'icon-language'
        # The default dimension that is applied when creating nodes without specifying a dimension
        # Crucially important are the default and defaultPreset keys: They define what language you get when visiting the root of the website; and when logging into the backend. So the default (2) must reference the value en_US, while the defaultPreset (3) must reference the preset en.
        default: 'pl'
        # The default preset to use if no URI segment was given when resolving languages in the router
        defaultPreset: 'pl'
        presets:
          pl:
            label: 'Polish (PL)'
            values:
              - pl
            uriSegment: 'pl'
          en_US:
            label: 'English (US)'
            values:
              - en_US
            uriSegment: 'en'

By running ./flow node:migrate 20150716212459 everything worked as expected. But by only having those two languages, i thought i will also only see those two languages in the backend. It seems like i also see the languages from all the other site packages:

image

The other languages are configured in all the other site packages. As well as in the Neos.Demo. By adding languges to those files as e.g. in Neos.Demo: Settings.CR.yaml it will appear in the backend.

I’m having that issue also with some other Page Nodes. E.g. i can add the Landing Page from the Neos.Demo into my newly added Project.

I found a solution by adding the following to my NodeTypes.yaml

'Neos.Demo:Document.LandingPage':
  abstract: true

But this does not just makes it unable to add, also it deletes all elements of this element in the Neos.Demo Project.

Is there a general mistake i’ve did? Basicially i just want to have a multi domain setup in Neos (Which is working fine) but also the Site Packages should be isolated from each other.

Thanks a lot for reading! :slight_smile:

I think sometimes it is good to have a look into the Neos.Demo code regarding constraints such as e.g.:

Document.yaml:

'Vendor.Neos:Document':

  # abstract: true
  superTypes:
    'Neos.Neos:Document': true
  constraints:
    nodeTypes:
      # The generic rule to allow all documents is disabled
      'Neos.Neos:Document': false
      # Instead all documents that are marked as vendor.Vendor:Constraint.Document.SubPage are allowed
      'Vendor.Neos:Constraint.Document.SubPage': true

Page.yaml:

'vendor.Vendor:Document.Page':
  superTypes:
    'Vendor.Neos:Constraint.Document.SubPage': true
    'Vendor.Neos:Document': true

  constraints:
    nodeTypes:
      'Neos.Demo:Constraint.Document.SubPage': true

SubPage.yaml:

'Vendor.Neos:Constraint.Document.SubPage':
  abstract: true

Tada, only the wanted Page object within my new Site Package is available.

Now i’m hoping to adapt kinda the same with the languages :smiley:

The language configuration is in Neos 8.3 still global. In neos 9 you will be able to setup multiple content repositories with different languages.

BTW it’s not a good idea to still have the neos demo installed in your own custom project, as it will conflict with your config ^^

1 Like

Good Morning @Marc!

Thanks a lot for your answer! That’s really interesting to know.

We have around four site packages and luckily we didn’t detected that issue until now, as the others are in only one language. (Well, i always wondered why there is a in the german page…)

The global language makes it hard for me, even more because i’m having (wanting) different defaults and defaultpresets per site package.

So currently there is no solution or maybe a workaround? Maybe i could configure the root to Polish for this project, within my nginx :thinking:

Yes, actually to have the Neos.Demo enabled is giving quite some headaches. But also some other site packages are not yet good isolated. It was also a hard learning within the Media Management… Currently we (mis)use Neos.Demo as backend provider for our login with OIDC. So until now, we need it :smiley:

The only workaround is to use GitHub - punktDe/sitespecifics: Site specific configuration for the Neos backend and hide certain dimensions in each site. But they will still all share the same configuration.

1 Like