Help with "namespace name 'Localization' does not exist"

Topics: Localization
May 5, 2014 at 4:27 AM
Hello everyone,
I seem to have gone and done something dumb and killed my Localization, for EN-us and EN-au in a custom theme. (See the error below)

I can create the problem when I try to create a blog archive widget.
Is there some secret sauce I can try to first, disable the localization stuff and if my page will render w/o it, how do I re-install it to make it work again?

Thank you for your time,

Server Error in '/' Application.

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 'Localization' does not exist in the namespace 'Orchard.Core.Shapes' (are you missing an assembly reference?)

Source Error:

Line 5: Script.Require("BlogsArchives");
Line 6: IEnumerable<KeyValuePair<ArchiveData, int>> archives = Model.Archives;
Line 7: var dateTimeLocalization = WorkContext.Resolve<Orchard.Core.Shapes.Localization.IDateTimeLocalization>();
Line 8: var monthNames = dateTimeLocalization.MonthNames.Text.Split(new [] {','}, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()).ToArray();
Line 9: }

Source File: g:\My Web Sites\orchard\Themes\FSSTheme\Views\Parts\Blogs.BlogArchives.cshtml Line: 7

Show Detailed Compiler Output:

Show Complete Compilation Source:

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18446
Jun 9, 2014 at 1:50 PM
Is this in a custom theme?

I came across a similar problem in the PJS.Bootstrap theme when trying to use Archives.
It looks like the Localization has been moved, replace line 7 with;
var dateTimeLocalization = WorkContext.Resolve<Orchard.Localization.Services.IDateTimeFormatProvider>();
You will then run into issues with the next line, to get it to work I replaced it with
var monthNames = dateTimeLocalization.MonthNames.ToArray();
It worked for me, though you may need to investigate that last bit to make sure localization works okay.