Permalink
Browse files

Added localization messages, localized area, clean-up some unused jav…

…ascript libraries and tweaked the route configuration
  • Loading branch information...
1 parent 61d7863 commit 64728869d7f952a044a4d75d6baee54f60aded81 @dproteau committed Apr 16, 2013
Showing with 1,209 additions and 20,157 deletions.
  1. +45 −5 src/M13n/App_Start/RouteConfig.cs
  2. +31 −0 src/M13n/Areas/Admin/AdminAreaRegistration.cs
  3. +20 −0 src/M13n/Areas/Admin/Controllers/DashboardController.cs
  4. +14 −0 src/M13n/Areas/Admin/Views/Dashboard/Index.cshtml
  5. +59 −0 src/M13n/Areas/Admin/Views/Web.config
  6. +3 −0 src/M13n/Areas/Admin/Views/_ViewStart.cshtml
  7. +27 −0 src/M13n/Content/Site.css
  8. BIN src/M13n/Content/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png
  9. BIN src/M13n/Content/themes/base/images/ui-bg_flat_75_ffffff_40x100.png
  10. BIN src/M13n/Content/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png
  11. BIN src/M13n/Content/themes/base/images/ui-bg_glass_65_ffffff_1x400.png
  12. BIN src/M13n/Content/themes/base/images/ui-bg_glass_75_dadada_1x400.png
  13. BIN src/M13n/Content/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png
  14. BIN src/M13n/Content/themes/base/images/ui-bg_glass_95_fef1ec_1x400.png
  15. BIN src/M13n/Content/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png
  16. BIN src/M13n/Content/themes/base/images/ui-icons_222222_256x240.png
  17. BIN src/M13n/Content/themes/base/images/ui-icons_2e83ff_256x240.png
  18. BIN src/M13n/Content/themes/base/images/ui-icons_454545_256x240.png
  19. BIN src/M13n/Content/themes/base/images/ui-icons_888888_256x240.png
  20. BIN src/M13n/Content/themes/base/images/ui-icons_cd0a0a_256x240.png
  21. +0 −473 src/M13n/Content/themes/base/jquery-ui.css
  22. +0 −16 src/M13n/Content/themes/base/jquery.ui.accordion.css
  23. +0 −12 src/M13n/Content/themes/base/jquery.ui.all.css
  24. +0 −18 src/M13n/Content/themes/base/jquery.ui.autocomplete.css
  25. +0 −25 src/M13n/Content/themes/base/jquery.ui.base.css
  26. +0 −40 src/M13n/Content/themes/base/jquery.ui.button.css
  27. +0 −39 src/M13n/Content/themes/base/jquery.ui.core.css
  28. +0 −67 src/M13n/Content/themes/base/jquery.ui.datepicker.css
  29. +0 −22 src/M13n/Content/themes/base/jquery.ui.dialog.css
  30. +0 −30 src/M13n/Content/themes/base/jquery.ui.menu.css
  31. +0 −12 src/M13n/Content/themes/base/jquery.ui.progressbar.css
  32. +0 −21 src/M13n/Content/themes/base/jquery.ui.resizable.css
  33. +0 −11 src/M13n/Content/themes/base/jquery.ui.selectable.css
  34. +0 −25 src/M13n/Content/themes/base/jquery.ui.slider.css
  35. +0 −23 src/M13n/Content/themes/base/jquery.ui.spinner.css
  36. +0 −18 src/M13n/Content/themes/base/jquery.ui.tabs.css
  37. +0 −248 src/M13n/Content/themes/base/jquery.ui.theme.css
  38. +0 −21 src/M13n/Content/themes/base/jquery.ui.tooltip.css
  39. BIN src/M13n/Content/themes/base/minified/images/ui-bg_flat_0_aaaaaa_40x100.png
  40. BIN src/M13n/Content/themes/base/minified/images/ui-bg_flat_75_ffffff_40x100.png
  41. BIN src/M13n/Content/themes/base/minified/images/ui-bg_glass_55_fbf9ee_1x400.png
  42. BIN src/M13n/Content/themes/base/minified/images/ui-bg_glass_65_ffffff_1x400.png
  43. BIN src/M13n/Content/themes/base/minified/images/ui-bg_glass_75_dadada_1x400.png
  44. BIN src/M13n/Content/themes/base/minified/images/ui-bg_glass_75_e6e6e6_1x400.png
  45. BIN src/M13n/Content/themes/base/minified/images/ui-bg_glass_95_fef1ec_1x400.png
  46. BIN src/M13n/Content/themes/base/minified/images/ui-bg_highlight-soft_75_cccccc_1x100.png
  47. BIN src/M13n/Content/themes/base/minified/images/ui-icons_222222_256x240.png
  48. BIN src/M13n/Content/themes/base/minified/images/ui-icons_2e83ff_256x240.png
  49. BIN src/M13n/Content/themes/base/minified/images/ui-icons_454545_256x240.png
  50. BIN src/M13n/Content/themes/base/minified/images/ui-icons_888888_256x240.png
  51. BIN src/M13n/Content/themes/base/minified/images/ui-icons_cd0a0a_256x240.png
  52. +0 −5 src/M13n/Content/themes/base/minified/jquery-ui.min.css
  53. +0 −5 src/M13n/Content/themes/base/minified/jquery.ui.accordion.min.css
  54. +0 −5 src/M13n/Content/themes/base/minified/jquery.ui.autocomplete.min.css
  55. +0 −5 src/M13n/Content/themes/base/minified/jquery.ui.button.min.css
  56. +0 −5 src/M13n/Content/themes/base/minified/jquery.ui.core.min.css
  57. +0 −5 src/M13n/Content/themes/base/minified/jquery.ui.datepicker.min.css
  58. +0 −5 src/M13n/Content/themes/base/minified/jquery.ui.dialog.min.css
  59. +0 −5 src/M13n/Content/themes/base/minified/jquery.ui.menu.min.css
  60. +0 −5 src/M13n/Content/themes/base/minified/jquery.ui.progressbar.min.css
  61. +0 −5 src/M13n/Content/themes/base/minified/jquery.ui.resizable.min.css
  62. +0 −5 src/M13n/Content/themes/base/minified/jquery.ui.selectable.min.css
  63. +0 −5 src/M13n/Content/themes/base/minified/jquery.ui.slider.min.css
  64. +0 −5 src/M13n/Content/themes/base/minified/jquery.ui.spinner.min.css
  65. +0 −5 src/M13n/Content/themes/base/minified/jquery.ui.tabs.min.css
  66. +0 −5 src/M13n/Content/themes/base/minified/jquery.ui.theme.min.css
  67. +0 −5 src/M13n/Content/themes/base/minified/jquery.ui.tooltip.min.css
  68. +12 −5 src/M13n/Controllers/CultureController.cs
  69. +2 −6 src/M13n/Controllers/HomeController.cs
  70. +6 −6 src/M13n/Helpers/CultureIdentifier.cs
  71. +0 −2 src/M13n/Helpers/MultiCultureMvcRouteHandler.cs
  72. +24 −66 src/M13n/M13n.csproj
  73. +18 −0 src/M13n/Resources/AppStrings.Designer.cs
  74. +69 −63 src/M13n/Resources/AppStrings.en.resx
  75. +69 −63 src/M13n/Resources/AppStrings.es.resx
  76. +69 −63 src/M13n/Resources/AppStrings.fr.resx
  77. +69 −63 src/M13n/Resources/AppStrings.resx
  78. +81 −0 src/M13n/Resources/Areas/Admin/Views/DashboardStrings.Designer.cs
  79. +126 −0 src/M13n/Resources/Areas/Admin/Views/DashboardStrings.en.resx
  80. +126 −0 src/M13n/Resources/Areas/Admin/Views/DashboardStrings.es.resx
  81. +126 −0 src/M13n/Resources/Areas/Admin/Views/DashboardStrings.fr.resx
  82. +126 −0 src/M13n/Resources/Areas/Admin/Views/DashboardStrings.resx
  83. BIN src/M13n/Scripts/_references.js
  84. +0 −14,912 src/M13n/Scripts/jquery-ui-1.9.2.js
  85. +0 −5 src/M13n/Scripts/jquery-ui-1.9.2.min.js
  86. +0 −3,577 src/M13n/Scripts/knockout-2.2.0.debug.js
  87. +0 −85 src/M13n/Scripts/knockout-2.2.0.js
  88. +36 −11 src/M13n/Views/Home/About.cshtml
  89. +16 −9 src/M13n/Views/Home/Index.cshtml
  90. +27 −8 src/M13n/Views/Shared/_CultureSwitchControl.cshtml
  91. +7 −4 src/M13n/Views/Shared/_Layout.cshtml
  92. +1 −1 src/M13n/Web.config
  93. +0 −2 src/M13n/packages.config
@@ -14,19 +14,59 @@ public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
+ // Default route clone with explicit localization
routes.MapRoute(
name: "MultiCulture",
- url: "{culture}/{controller}/{action}/{id}",
- defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
- constraints: new { culture = new CultureConstraint(Enum.GetNames(typeof(CultureIdentifier))) }
+ url: "{controller}/{action}/{id}",
+ defaults: new {controller = "Home", action = "Index", id = UrlParameter.Optional}
).RouteHandler = new MultiCultureMvcRouteHandler();
+ // Default route without explicit localization
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
- defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
- ).RouteHandler = new SingleCultureMvcRouteHandler();
+ defaults: new {controller = "Home", action = "Index", id = UrlParameter.Optional}
+ );
+
+ LocalizeRoutes(routes);
+
+ }
+
+ /// <summary>
+ /// Apply localization to MulticultureMvcRoutes
+ /// </summary>
+ /// <param name="routes"></param>
+ private static void LocalizeRoutes(IEnumerable<RouteBase> routes)
+ {
+ CultureConstraint cc = null;
+
+ foreach (Route r in routes)
+ {
+ if (r.RouteHandler is MultiCultureMvcRouteHandler)
+ {
+ const string urlSegment = "{culture}/";
+ if (!r.Url.StartsWith(urlSegment))
+ {
+ r.Url = urlSegment + r.Url;
+ }
+
+ /* If you want an explicit default culture then just uncomment this bloc
+ //Adding default culture
+ if (r.Defaults == null)
+ {
+ r.Defaults = new RouteValueDictionary();
+ }
+ r.Defaults["culture"] = CultureIdentifier.en.ToString();
+ */
+ //Adding constraint for culture param
+ if (r.Constraints == null)
+ {
+ r.Constraints = new RouteValueDictionary();
+ }
+ r.Constraints["culture"] = cc ?? (cc = new CultureConstraint(Enum.GetNames(typeof (CultureIdentifier))));
+ }
+ }
}
}
}
@@ -0,0 +1,31 @@
+using System.Web.Mvc;
+using M13n.Helpers;
+
+namespace M13n.Areas.Admin
+{
+ public class AdminAreaRegistration : AreaRegistration
+ {
+ public override string AreaName
+ {
+ get
+ {
+ return "Admin";
+ }
+ }
+
+ public override void RegisterArea(AreaRegistrationContext context)
+ {
+ context.MapRoute(
+ "Admin_MultiCulture",
+ "Admin/{controller}/{action}/{id}",
+ new { action = "Index", id = UrlParameter.Optional }
+ ).RouteHandler = new MultiCultureMvcRouteHandler();
+
+ context.MapRoute(
+ "Admin_default",
+ "Admin/{controller}/{action}/{id}",
+ new {action = "Index", id = UrlParameter.Optional}
+ );
+ }
+ }
+}
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.Mvc;
+
+namespace M13n.Areas.Admin.Controllers
+{
+ public class DashboardController : Controller
+ {
+ //
+ // GET: /Admin/Dashboard/
+
+ public ActionResult Index()
+ {
+ return View();
+ }
+
+ }
+}
@@ -0,0 +1,14 @@
+@using M13n.Resources.Areas.Admin.Views
+
+@section featured {
+
+ <section class="featured">
+ <div class="content-wrapper">
+ <h1>@DashboardStrings.Dashboard_Title</h1>
+ <p>
+ @DashboardStrings.Dashboard_FeatureText
+ </p>
+ </div>
+ </section>
+
+}
@@ -0,0 +1,59 @@
+<?xml version="1.0"?>
+
+<configuration>
+ <configSections>
+ <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
+ <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
+ <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
+ </sectionGroup>
+ </configSections>
+
+ <system.web.webPages.razor>
+ <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
+ <pages pageBaseType="System.Web.Mvc.WebViewPage">
+ <namespaces>
+ <add namespace="System.Web.Mvc" />
+ <add namespace="System.Web.Mvc.Ajax" />
+ <add namespace="System.Web.Mvc.Html" />
+ <add namespace="System.Web.Optimization"/>
+ <add namespace="System.Web.Routing" />
+ </namespaces>
+ </pages>
+ </system.web.webPages.razor>
+
+ <appSettings>
+ <add key="webpages:Enabled" value="false" />
+ </appSettings>
+
+ <system.web>
+ <httpHandlers>
+ <add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/>
+ </httpHandlers>
+
+ <!--
+ Enabling request validation in view pages would cause validation to occur
+ after the input has already been processed by the controller. By default
+ MVC performs request validation before a controller processes the input.
+ To change this behavior apply the ValidateInputAttribute to a
+ controller or action.
+ -->
+ <pages
+ validateRequest="false"
+ pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
+ pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
+ userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
+ <controls>
+ <add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
+ </controls>
+ </pages>
+ </system.web>
+
+ <system.webServer>
+ <validation validateIntegratedModeConfiguration="false" />
+
+ <handlers>
+ <remove name="BlockViewHandler"/>
+ <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
+ </handlers>
+ </system.webServer>
+</configuration>
@@ -0,0 +1,3 @@
+@{
+ Layout = "~/Views/Shared/_Layout.cshtml";
+}
View
@@ -204,6 +204,33 @@ ul#menu {
text-decoration: none;
}
+/* Language Selector
+----------------------------------------------------------*/
+ul#langselect {
+ font-size: 1em;
+ font-weight: 600;
+ margin: 0 0 5px;
+ padding: 0;
+ text-align: right;
+}
+
+ ul#langselect li {
+ display: inline;
+ list-style: none;
+ padding-left: 15px;
+ }
+
+ ul#langselect li a {
+ background: none;
+ color: #999;
+ text-decoration: none;
+ }
+
+ ul#langselect li a:hover {
+ color: #333;
+ text-decoration: none;
+ }
+
/* page elements
----------------------------------------------------------*/
Deleted file not rendered
Deleted file not rendered
Deleted file not rendered
Deleted file not rendered
Deleted file not rendered
Deleted file not rendered
Oops, something went wrong.

0 comments on commit 6472886

Please sign in to comment.