OrchardCMS / Orchard

Orchard is a free, open source, community-focused Content Management System built on the ASP.NET MVC platform.
https://orchardproject.net
BSD 3-Clause "New" or "Revised" License
2.37k stars 1.12k forks source link

Orchard CMS 1.9 Content Localization Not working when adding translation for Custom Link MENU #5716

Open rgherman opened 8 years ago

rgherman commented 8 years ago

I have Orchard CMS 1.9 With enabled Content Localization MODULE

I added localization to the "Custom Link" Content Type.

Now when I go to Navigation and try to add a new translation for a Custom Link - it saves it, but does not appear in the list and in the site.

I noticed that in the database it saves this menu item with MenuId = 0

Jetski5822 commented 8 years ago

I am not sue localization on menus is possible, though yes, you can add a localization part... I don't think people actually do this. Most people have different menus per local...

rgherman commented 8 years ago

Actually we did this for more than 20 sites. and it worked for orchard 1.8 and below and now it doesn't.

I'm not sure I understand the last statement. Could you please elaborate? 1) I thought localization should work with any part 2) if you say we are doing it wrong, can you tell me how to do it correct?

urbanit commented 8 years ago

I can confirm that menu localisation does not work for us. We had to create 2 menus and overidding menu.cshtml

rgherman commented 8 years ago

The problem is in: AdminController, from OrchardLocalization module.

First of all it is not correct to pass masterContentItem in: var content = _contentManager.BuildEditor(masterContentItem);

as the Model.ContentItem.ContentItem.Id == 0 is always false in Localization.ContentTranslations.Edit.cshtml

BUT, even if I pass contentItemTranslation, the problem here is that the MenuPartDriver.cs CurrentMenuId is assigned -1: CurrentMenuId = part.Menu == null ? -1 : part.Menu.Id,

because part.Menu is null in this case.

I had to introduce a new property, in order to verify if this is a new Transaltion for the menu or not, and use that to determine what to display on the Translation ui.

This is a problem for any ContentItem not only Menu Translation.

Hope someone from contributers will fix this soon.

If someone needs details about the fix, let me know

sebastienros commented 8 years ago

Are you using 1.9.x ? We fixed something less than 2 weeks ago about the master content item in the controller.

20 sites with Orchard? OMG, tell us more!

rgherman commented 8 years ago

Hi Sebastien,

I saw the master content item change - and that is actually causing additional problems - there is no Language Dropdown displayed.

nqynik commented 8 years ago

rgherman - please can you provide more details on the fix?

alimuradjamali commented 6 years ago

rgherman - please can you provide more details on the fix? I want the source code plz for this issue.