Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix for language detection in URL path

  • Loading branch information...
commit 02e900337a46831cd681354f6efc3a945b0b8b67 1 parent 95eeb6c
@activa activa authored
View
10 Library/Source/Utility/UrlHelper.cs
@@ -27,6 +27,7 @@
using System;
using System.Collections.Generic;
using System.Text;
+using Vici.Core;
namespace Vici.Mvc
{
@@ -49,6 +50,12 @@ internal static string GetLanguageFromUrl()
string url = SessionBase.Request.AppRelativeCurrentExecutionFilePath.Substring(2);
+ int idx1 = url.IndexOf('/');
+
+ if (idx1 == 2)
+ return url.Left(2);
+
+ /*
int idx1 = url.LastIndexOf('/');
if (idx1 > 0)
@@ -60,7 +67,8 @@ internal static string GetLanguageFromUrl()
else
return url.Substring(0,idx1);
}
-
+ */
+
return "";
}
View
8 Library/Source/WebApp/Config/WebAppConfig.cs
@@ -78,10 +78,6 @@ public static class WebAppConfig
private static readonly object _initLock = new object();
private static bool _initialized;
-// static WebAppConfig()
-// {
-// }
-
private class ObjectBinder : IStringConverter
{
private static readonly List<IObjectBinder> _customObjectBinders = new List<IObjectBinder>();
@@ -141,7 +137,7 @@ public static void Init()
break;
case "promesh.defaultlanguage":
case "mvc.defaultlanguage":
- DefaultLanguage = configValue.ToUpper();
+ DefaultLanguage = configValue;
break;
case "promesh.applicationclass":
case "mvc.applicationclass":
@@ -272,7 +268,7 @@ public static string DefaultLayout
public static string DefaultLanguage
{
get { return _defaultLanguage; }
- set { _defaultLanguage = value; }
+ set { _defaultLanguage = value.ToLower(); }
}
public static bool UseLanguagePath
View
BIN  References/Externals/Vici.Core.dll
Binary file not shown
View
5 Tests/OfflineBrowserTests/LanguageUrlTest.cs
@@ -36,6 +36,11 @@ public void TestSpecificLanguageInUrl()
_browser.PageGet("/fr/index");
Assert.AreEqual("fr", WebAppContext.Session.LanguageCode);
+
+ _browser.PageGet("/nl/index/test");
+
+ Assert.AreEqual("nl", WebAppContext.Session.LanguageCode);
+
}

0 comments on commit 02e9003

Please sign in to comment.
Something went wrong with that request. Please try again.