This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Verbat
Verbat

My current settings:

Edge Updates are enabled.
I'm running October with
Core: 365
Pages: 1.2.10
Translate: 1.2.4 (forceURL = 0)

My Problem:
I've created a website with two different languages (DE + EN) and I can switch languages using the language switcher without any problems. The regular content get translated every time as intended.

The only problem is that the static pages menu sometimes shows only the menu with the original language titles and urls at both languages, which unfortunately results in a 404 as the translated english url does not work at the german website.

If i'm deleting the cache in the backend it will work again and shows the correct url and title for each language. But after some time (hours) the same problem succours again and only the menu from the default language shows at both language versions.

I'm switching languages with:

<a class="item" data-request-data="locale: 'de'" data-request="onSwitchLocale" href="#">Deutsch </a>
<a class="item" data-request-data="locale: 'en'" data-request="onSwitchLocale" href="#">English </a>

Menu:
Name: Main Menu
Code: main-menu
Menu items: all static pages

Layout:
Static menu component included
Alias: mainmenu

I include the menu like this (default static menu component behaves the same):

{% partial 'sidebar/menu-items' items=sidebarmenu.menuItems %}

My partial looks like this:

{# Custom navigation implementation that only shows 1 levels deep #}´
{% for item in items %}
<a href="{{ item.url }}" class="item">  {{ item.title }}</a>
{% endfor %}

Any ideas what's wrong or how I can track down what causes the issue.

Last updated

Minius
Minius

Hi, i have same problem, something wrong with cache&session. Any solutions, fix ?

Verbat
Verbat

There was an update a few days ago which might have fixed this issue. If edge updates are enabled you should be able to install it. https://github.com/rainlab/translate-plugin/issues/165

If it's still not working you can temporarily hard-code the menu in content blocks and include them like it's mentioned at the translate plugin documentation. https://octobercms.com/plugin/rainlab-translate

Content translation:

This plugin activates a feature in the CMS that allows content files to use language suffixes, for example:

welcome.htm will contain the content in the default language.
welcome.ru.htm will contain the content in Russian.
welcome.fr.htm will contain the content in French.

If it's working with the current update would be great if you can let me know so i can rewert my temporary fix.

Minius
Minius

thank, for replay.

Yes, edgeUpdates done before, but without success. My solution was changing default locale in config/app.php same as locale in backend, translation plugin. I think, default locale in translation plugin must be higher than in app.php config file?

frederic.chiasson25898
frederic.chiasson25898

I had the same problem for home page, but not for other pages. I found out that [localePicker] was in both the home page and its layout. The [localePicker] in home page had no variables at all, so I removed it. With only the [localePicker] in the layout, the locale switch in home page was working again.

ranmichael
ranmichael

@verbat, I am experiencing this in Build 430 & Translate Build 1.3.3 (Both the latest up to date) [LocalePickers] are only present in layouts, applied to static pages.

The workaround I found was to check the 'Force URL Schema' option in the LocalePicker Component when attaching to the layout. Yes, this means that your url would always be http://yourdomain.com/en or /fr but this forces the system to select the right locale when loading the URIs for the StaticMenu items.

So here is my solution

  • I have a static menu for each language: called staticMenuen and staticMenuen so it is automatically selected by concatinating the {{ activeLocale }} variable like this: {% component 'staticFooterMenu'~activeLocale %}

Interestingly enough, when not forcing the url schema in the component- the correct menu will show (meaning the locale is selected) - with the correct menu labels translated, but with the eventually wrong urls behind the labels - which must be a cache problem somewhere.

Hope this helps someone.

laszlo.zenware.io
laszlo.zenware.io

Minius said:

thank, for replay.

Yes, edgeUpdates done before, but without success. My solution was changing default locale in config/app.php same as locale in backend, translation plugin. I think, default locale in translation plugin must be higher than in app.php config file?

^^ this worked for me as well where my static menu was not heeding the default language set in the translate plugin (even though everything else was).

1-7 of 7

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.