-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Menu items without label are removed from the menu #256
Comments
Correct, "Hide Content .." is for content of posts and pages only, not menu, not widgets etc. Empty menu labels allow to manipulate menus in a more flexible way. How would you show menu item with empty label anyway? What is it exactly you are trying to achieve? |
I would display it in the same way that any other content is displayed, if there is no translation, fall back to the default language. I have a website where a few pages are translated into a lot of languages, and a lot of pages are only in English. What I'm trying to achieve is that all menu items appear in all languages, even if the page is not translated into that language. With the way that qtranslate-x currently works, I would have to copy the English page title / menu item label into every language where a translation doesn't exist. |
Menu items do not change dynamically, like content does, that is why it is assumed that an administrator tunes all menu items as needed, and no trick is necessary to show empty items in English, since the administrator can always fill it in appropriately. I believe it is good enough design and no changes are needed.
I do not really understand why it is so. What is wrong with empty title on a page? The content in English is still shown, is not it? Maybe a list of steps to reproduce the problem under a simple standard theme with the minimum of active plugins can help to understand what you mean? |
I tried to reproduce the problem with these steps:
When I just tested it, it actually worked and the menu item was there with the title in the default language. But when I add any existing pages (that also have only a title and content in the default language) to the menu, they are not displayed in the menu. I need to investigate more to find out how this happens. |
In this case you would need to fill menu labels manually. Page can be translated later, but menu is supposed to be always translated and fully ready. You may still put English there temporarily. String like "(English) Text" would look awkward in menu anyway. In many cases, one wish menu item to have a little bit different text, than the page title. WP puts there page title by default, just to have something in menu, assuming that admin will change it. That it the currently designed approach, which seems to work for the majority of the cases. I would not mind to change the design, like if menu item is the default, meaning not altered by the admin and gets from the page title, then apply your rule. And I am sure there will be someone who would still want it back to how it is now, so it needs to be on an option. Due to a low demand on this feature it would get a low priority for us, but you are more than welcome to figure out the code for this and to submit a pull request. Please, make sure that the current functionality stays intact by default in order not to break anyone's site. I will close the issue for now, we can still write into closed issue or can reopen it when needed. If you submit a pull request, refer to this issue. |
In my case, most of the pages only exist in English, so it would be a ridiculous amount of work to set the label of hundreds of pages in all the languages. About the "(English) Text" I agree, that’s why I disabled the option to add that prefix. About backwards compatibility, we were using qtranslate and then mqtranslate before, and both were not removing the untranslated items from the menu. So I think the current behaviour also breaks a lot of sites when they migrate to qtranslate-x. I will create a pull request that adds an option as soon as I find time. |
Do you have hundreds of menu entries? Normally menu is less than 40-50 items and it does not change every day, almost never actually, is not it your case? I am sorry I am still trying to understand why this is a problem for you. I would think that, right the opposite, people would like to have all menu is properly done and nicely translated, while pages themselves can change and can be translated later. |
My use case is a page for a volunteer-based project. The page is edited by a lot of different people who don't communicate with each other a lot, many people are only temporarily involved in the project and will only edit a few things on the website. The site has about 75 pages and currently 11 languages set up. In most of those languages, a translation for the front page and maybe one or two other pages have been contributed by volunteers, the rest is only available in English. It makes a lot of sense to have these translations, as people who don't speak English will get a general overview about the project on the front page, but it also makes sense to show all pages that have not been translated, so that at least those who do speak English will see that there is more information available. The problem is that content is often created by people whose only involvement in the website is to create one page or add one language to provide the translation for one page, and those people will neither know nor guess that when they create a menu entry, they will have to copy the page title to all the other languages (or in case they set up a new language, to copy the page titles of all 75 pages in the menu to the new language). (The other thing is that the menu recently got lost because of the max_input_vars issue, and now I would have to paste about 75*10 page titles to make the menu complete in all languages). |
(Note to self and in case someone else has the same issue: The workaround is to edit |
I am sorry about lose of menu. I thought that when max_input_vars error appears it does not remove old items, it just does not let you insert new ones. This is the first report on menu lost. Are you sure that was a case? We need to program then some kind of guard to prevent menu lose. I hope you can get most of it back from a backup ... |
Let me try to understand the problem again, is below a correct description: You wish all new pages created on the site to auto-appear in menu regardless how many they are? If many people work on a site, menu will probably have like a 100 pages soon this way. That alone does not sound right to me, I used to think that menu does not change that much dynamically and 100 items in a menu is too much for a normal user. It would think this needs to be re-designed. If you stick with this approach, then your problem is that when people enter just one language on a new page, the menu item gets auto-created, but it is shown only for one language, and you wish it to be shown for all languages. Is it correct? Once again, it looks awkward to me that menu items will appear in different languages then. Anyway, I am glad that you figure out the changes needed for you in the code. Maybe one day we will add another option to control how menu items are shown, or if you have time, you may design such an option and submit a pull request with the code needed. Thank you. |
I don't want the pages to be added to the menu automatically. I just want the menu items to be the same in all languages. So if someone adds a menu item, the item should be listed in the menu in all languages, regardless on whether the page is translated to that language. Currently, to achieve this, editors have to add the menu item, then scroll all the way up or down in the menu administration, then select another language, scroll back to the menu item, copy in the translated title, scroll back up to select another language and so on (for every language available). This is first of all not very intuitive and most of them will not know or not think of doing that, and second of all it is still a lot of unnecessary steps and prone to forgetting some languages. I will take care of a pull request soon. |
For me it was enough to comment these two lines out in qtranslate_frontend.php in order to show menu entries in the default language as fallback:
|
Is there a better approach to this since this was discussed here? |
The plugin developer disagrees with people about good ideas, and then disappears forever. That's what happened to this plugin. We on our own. |
@herrvigg I'm sorry for that last comment, I can actually say that you are pretty good at being on top of things ;)
The above suggestion of commenting those 2 lines worked for me, but thought I should let you know. If I get some time I'll try to come up with a more proper solution than just commenting code lol. |
No worry, this was not for me 😅 Good you re-visit the issue database, there is still a lot of information that is valid so i did well to bring it back. |
Ohh he referred to the previous devs, phew cool then. Here's a quick vid of what's happening and how you can replicate the error, hope it helps 😄 |
Follow-up for new feature in #1063. |
Friday Sep 11, 2015 at 13:51 GMT
Originally opened as qTranslate-Team/qtranslate-x#256
Menu items with an empty label are removed from the menu. For example, when adding a page that only has an English translation (and thus its Italian title is empty), in the Italian version of the menu this page will be missing. This behaviour is unexpected, as there is a setting “Hide Content which is not available for the selected language”, which is not respected for menus.
The expected behaviour would be that either the “Hide Content” setting is respected for menu items with an empty label, or even better to have a separate global or per-menu setting for this specific issue.
The text was updated successfully, but these errors were encountered: