Problem instaling localization

Topics: Troubleshooting
Apr 16, 2011 at 5:49 PM

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0234: The type or namespace name 'ImportContentContext' does not exist in the namespace 'Orchard.ContentManagement.Handlers' (are you missing an assembly reference?)

Source Error:

 
Line 79:         }
Line 80: 
Line 81:         protected override void Importing(LocalizationPart part, ContentManagement.Handlers.ImportContentContext context) {
Line 82:             var masterContentItem = context.Attribute(part.PartDefinition.Name, "MasterContentItem");
Line 83:             if (masterContentItem != null) {


Source File: g:\Websites\vdraw\vdraw\Modules\Orchard.Localization\Drivers\LocalizationPartDriver.cs    Line: 81          

 

Line 1:    using System.Collections.Generic;
Line 2:    using System.Linq;
Line 3:    using JetBrains.Annotations;
Line 4:    using Orchard.ContentManagement;
Line 5:    using Orchard.ContentManagement.Drivers;
Line 6:    using Orchard.Localization.Models;
Line 7:    using Orchard.Localization.Services;
Line 8:    using Orchard.Localization.ViewModels;
Line 9:    
Line 10:   namespace Orchard.Localization.Drivers {
Line 11:       [UsedImplicitly]
Line 12:       public class LocalizationPartDriver : ContentPartDriver<LocalizationPart> {
Line 13:           private const string TemplatePrefix = "Localization";
Line 14:           private readonly ICultureManager _cultureManager;
Line 15:           private readonly ILocalizationService _localizationService;
Line 16:           private readonly IContentManager _contentManager;
Line 17:   
Line 18:           public LocalizationPartDriver(ICultureManager cultureManager, ILocalizationService localizationService, IContentManager contentManager) {
Line 19:               _cultureManager = cultureManager;
Line 20:               _localizationService = localizationService;
Line 21:               _contentManager = contentManager;
Line 22:           }
Line 23:   
Line 24:           protected override DriverResult Display(LocalizationPart part, string displayType, dynamic shapeHelper) {
Line 25:               var masterId = part.MasterContentItem != null
Line 26:                                  ? part.MasterContentItem.Id
Line 27:                                  : part.Id;
Line 28:               return Combined(
Line 29:                   ContentShape("Parts_Localization_ContentTranslations",
Line 30:                                () => shapeHelper.Parts_Localization_ContentTranslations(ContentPart: part, MasterId: masterId, Localizations: GetDisplayLocalizations(part, VersionOptions.Published))),
Line 31:                   ContentShape("Parts_Localization_ContentTranslations_Summary",
Line 32:                                () => shapeHelper.Parts_Localization_ContentTranslations_Summary(ContentPart: part, MasterId: masterId, Localizations: GetDisplayLocalizations(part, VersionOptions.Published))),
Line 33:                   ContentShape("Parts_Localization_ContentTranslations_SummaryAdmin",
Line 34:                                () => shapeHelper.Parts_Localization_ContentTranslations_SummaryAdmin(ContentPart: part, MasterId: masterId, Localizations: GetDisplayLocalizations(part, VersionOptions.Latest)))
Line 35:                   );
Line 36:           }
Line 37:   
Line 38:           protected override DriverResult Editor(LocalizationPart part, dynamic shapeHelper) {
Line 39:               var localizations = GetEditorLocalizations(part).ToList();
Line 40:               var model = new EditLocalizationViewModel {
Line 41:                   SelectedCulture = part.Culture != null ? part.Culture.Culture : null,
Line 42:                   SiteCultures = _cultureManager.ListCultures().Where(s => s != _cultureManager.GetSiteCulture() && !localizations.Select(l => l.Culture.Culture).Contains(s)),
Line 43:                   ContentItem = part,
Line 44:                   MasterContentItem = part.MasterContentItem,
Line 45:                   ContentLocalizations = new ContentLocalizationsViewModel(part) { Localizations = localizations }
Line 46:               };
Line 47:   
Line 48:               return ContentShape("Parts_Localization_ContentTranslations_Edit",
Line 49:                   () => shapeHelper.EditorTemplate(TemplateName: "Parts/Localization.ContentTranslations.Edit", Model: model, Prefix: TemplatePrefix));
Line 50:           }
Line 51:   
Line 52:           protected override DriverResult Editor(LocalizationPart part, IUpdateModel updater, dynamic shapeHelper) {
Line 53:               var model = new EditLocalizationViewModel();
Line 54:               if (updater != null && updater.TryUpdateModel(model, TemplatePrefix, null, null)) {
Line 55:                   _localizationService.SetContentCulture(part, model.SelectedCulture);
Line 56:               }
Line 57:   
Line 58:               return Editor(part, shapeHelper);
Line 59:           }
Line 60:   
Line 61:           private IEnumerable<LocalizationPart> GetDisplayLocalizations(LocalizationPart part, VersionOptions versionOptions) {
Line 62:               return _localizationService.GetLocalizations(part.ContentItem, versionOptions)
Line 63:                   .Select(c => {
Line 64:                               var localized = c.ContentItem.As<LocalizationPart>();
Line 65:                               if (localized.Culture == null)
Line 66:                                   localized.Culture = _cultureManager.GetCultureByName(_cultureManager.GetSiteCulture());
Line 67:                               return c;
Line 68:                           }).ToList();
Line 69:           }
Line 70:   
Line 71:           private IEnumerable<LocalizationPart> GetEditorLocalizations(LocalizationPart part) {
Line 72:               return _localizationService.GetLocalizations(part.ContentItem, VersionOptions.Latest)
Line 73:                   .Select(c => {
Line 74:                       var localized = c.ContentItem.As<LocalizationPart>();
Line 75:                       if (localized.Culture == null)
Line 76:                           localized.Culture = _cultureManager.GetCultureByName(_cultureManager.GetSiteCulture());
Line 77:                       return c;
Line 78:                   }).ToList();
Line 79:           }
Line 80:   
Line 81:           protected override void Importing(LocalizationPart part, ContentManagement.Handlers.ImportContentContext context) {
Line 82:               var masterContentItem = context.Attribute(part.PartDefinition.Name, "MasterContentItem");
Line 83:               if (masterContentItem != null) {
Line 84:                   var contentItem = context.GetItemFromSession(masterContentItem);
Line 85:                   if (contentItem != null) {
Line 86:                       part.MasterContentItem = contentItem;
Line 87:                   }
Line 88:               }
Line 89:   
Line 90:               var culture = context.Attribute(part.PartDefinition.Name, "Culture");
Line 91:               if (culture != null) {
Line 92:                   var targetCulture = _cultureManager.GetCultureByName(culture);
Line 93:                   // Add Culture.
Line 94:                   if (targetCulture == null && _cultureManager.IsValidCulture(culture)) {
Line 95:                       _cultureManager.AddCulture(culture);
Line 96:                       targetCulture = _cultureManager.GetCultureByName(culture);
Line 97:                   }
Line 98:                   part.Culture = targetCulture;
Line 99:               }
Line 100:          }
Line 101:  
Line 102:          protected override void Exporting(LocalizationPart part, ContentManagement.Handlers.ExportContentContext context) {
Line 103:              if (part.MasterContentItem != null) {
Line 104:                  var masterContentItemIdentity = _contentManager.GetItemMetadata(part.MasterContentItem).Identity;
Line 105:                  context.Element(part.PartDefinition.Name).SetAttributeValue("MasterContentItem", masterContentItemIdentity.ToString());
Line 106:              }
Line 107:  
Line 108:              if (part.Culture != null) {
Line 109:                  context.Element(part.PartDefinition.Name).SetAttributeValue("Culture", part.Culture.Culture);
Line 110:              }
Line 111:          }
Line 112:      }
Line 113:  }

  

Apr 16, 2011 at 6:08 PM

Which Orchard version are you using?

Apr 16, 2011 at 6:17 PM

Hi there...

im using 1.1.30

Apr 16, 2011 at 6:22 PM

Is it an upgrade from 1.0.20 or a fresh install?

Apr 16, 2011 at 6:23 PM

fresh install

Apr 16, 2011 at 6:28 PM

Strange ... have you tried building in VS and/or running ClickToBuild.cmd? The error would imply some of the core projects are either not built or an old version perhaps cached.