Multilanguage CMS Page with identical slug

my multi language pages can be requested this way:

/some/segment -> Standard
/en/some/segment -> Standard Language
/de/some/segment
/cs/some/segment

Most of my pages are static pages in the view folder and I can use the same segment/slug for all pages

view/some/segment.php
view/some/en/segment.php
view/some/de/segment.php

But I can't do the same with CMS pages, or can I?
I really don't want to build a multilanguage menu. Any advice how to get around the fact that slugs need to be unique?

Comments

  • I'm not quite sure I follow. Are you not wanting to create each language page in the CMS. Or, are you specifically referring to the menu using the Navigation module and/or the fuel_nav() function and not wanting to create multiple languages for the menu?

  • Exactly, I want to use one menu using fuel_nav() and the language is always the first segment as described in the docs ( $config['language_mode'] = 'segment'; ) - That works with the static pages, but not with the CMS pages, right (because slug has to be unique)?

    I already tried to put the language in the slug (or location field) (in creating the cms page), but that didn't work. (Hope that makes sense)

    My menu array would be only, because $config['language_mode'] = 'segment'; handles everything.

    $nav = [
        'some' => [
            'label' => lang('translation_from_lang_file')
        ],
        'some/segment' => [
            'label' => lang('other_translation_from_lang_file')
        ]
    ];
    
    
  • When you set the site to be multiple languages and you create a new page in the CMS the slug for the language is not saved in the location value if that's what you mean. Instead, each page gets associated with a different set of page variables that belong to a different language and when constructing the page, it uses the language detected (either via the slug, querystring, etc).

    For example, if you create an "about" page for you site, you would create a single page with the location of "about" and then you should see an additional dropdown that specifies what language you want to save the variables for that page as.

  • Thank you! I totally missed that point. That makes sense now.

Sign In or Register to comment.