mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
- Adding a method to the CultureManager to return the default site culture (as opposed to current culture)
--HG-- branch : dev
This commit is contained in:
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Orchard.ContentManagement.MetaData.Models;
|
||||
using Orchard.ContentManagement.MetaData.Models;
|
||||
|
||||
namespace Orchard.ContentManagement {
|
||||
public class ContentField {
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Web;
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.Data;
|
||||
using Orchard.Localization.Records;
|
||||
using Orchard.Settings;
|
||||
|
||||
namespace Orchard.Localization.Services {
|
||||
public class DefaultCultureManager : ICultureManager {
|
||||
@@ -17,6 +18,8 @@ namespace Orchard.Localization.Services {
|
||||
_cultureSelectors = cultureSelectors;
|
||||
}
|
||||
|
||||
protected virtual ISite CurrentSite { get; [UsedImplicitly] private set; }
|
||||
|
||||
public IEnumerable<string> ListCultures() {
|
||||
var query = from culture in _cultureRepository.Table select culture.Culture;
|
||||
return query.ToList();
|
||||
@@ -51,6 +54,10 @@ namespace Orchard.Localization.Services {
|
||||
return _cultureRepository.Get(id);
|
||||
}
|
||||
|
||||
public string GetSiteCulture() {
|
||||
return CurrentSite == null ? null : CurrentSite.SiteCulture;
|
||||
}
|
||||
|
||||
// "<languagecode2>" or
|
||||
// "<languagecode2>-<country/regioncode2>" or
|
||||
// "<languagecode2>-<scripttag>-<country/regioncode2>"
|
||||
|
||||
@@ -8,5 +8,6 @@ namespace Orchard.Localization.Services {
|
||||
void AddCulture(string cultureName);
|
||||
string GetCurrentCulture(HttpContext requestContext);
|
||||
CultureRecord GetCultureById(int id);
|
||||
string GetSiteCulture();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user