mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Use the referrer to determine the language if it is a POST
This commit is contained in:
@@ -30,4 +30,4 @@ Features:
|
||||
Description: Enabled transliteration of the slug when creating a piece of content
|
||||
Category: Content
|
||||
Name: Url Transliteration
|
||||
Dependencies: Orchard.Localization.Transliteration
|
||||
Dependencies: Orchard.Localization.Transliteration, Orchard.Autoroute
|
@@ -52,18 +52,12 @@
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
|
@@ -34,9 +34,15 @@ namespace Orchard.Localization.Providers {
|
||||
if (!IsActivable(context))
|
||||
return null;
|
||||
|
||||
var content = GetByPath(context.Request.Path.TrimStart('/'));
|
||||
var path = context.Request.Path;
|
||||
if (context.Request.HttpMethod.Equals("POST", StringComparison.OrdinalIgnoreCase)
|
||||
&& context.Request.UrlReferrer != null) {
|
||||
path = context.Request.UrlReferrer.AbsolutePath;
|
||||
}
|
||||
|
||||
var content = GetByPath(path.TrimStart('/'));
|
||||
if (content != null) {
|
||||
return new CultureSelectorResult {Priority = -1, CultureName = _localizationService.Value.GetContentCulture(content)};
|
||||
return new CultureSelectorResult { Priority = -1, CultureName = _localizationService.Value.GetContentCulture(content) };
|
||||
}
|
||||
|
||||
return null;
|
||||
|
Reference in New Issue
Block a user