Search code examples
djangodjango-cms

DjangoCMS show menu on wrong language


I have site https://www.mobydisc.de/. It have DE and EN versions. When i go to the site from browser, all content of site is on DE.

When i check site with https://www.google.com/webmasters/tools/googlebot-fetch-details, content is on DE, but menu on EN.

How i can fix it?

Settings :

LANGUAGE_CODE = 'de'
TIME_ZONE = 'Europe/Berlin'
USE_I18N = True
USE_L10N = True
USE_TZ = True
CMS_LANGUAGES = {
1: [
    {
        'code': 'de',
        'name': gettext('Deutsch'),
        'fallbacks': ['en'],
        'public': True,
    },
    {
        'code': 'en',
        'name': gettext('English'),
        'fallbacks': ['de'],
        'public': True,
        'hide_untranslated': True,
        'redirect_on_fallback':False,
    },
],
'default': {
    'fallbacks': ['de'],
    'redirect_on_fallback':True,
    'public': True,
    'hide_untranslated': False,
    }
}
LANGUAGES = [
    ('de', 'Deutsch'),
    ('en', 'English'),
]

Filter :

@register.filter(name="get_menu_title_without_mega")
    def get_menu_title_without_mega(text):
        if megamenu(text):
            # print("mega remove")
            regexp  = re.compile("[ ]+mega[0-9]+$", re.MULTILINE)
            # print(text,regexp.sub("",text))
            return regexp.sub("",text)
        else:
            return text`

Image example


Solution

  • This helps me https://www.djangosnippets.org/snippets/218/

    All i need to do is Ignore HTTP Accept-Language headers