本文整理汇总了C#中Culture类的典型用法代码示例。如果您正苦于以下问题:C# Culture类的具体用法?C# Culture怎么用?C# Culture使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Culture类属于命名空间,在下文中一共展示了Culture类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TimeToString
public static string TimeToString(TimeSpan timeSpan, Culture culture)
{
string s = "";
switch (culture)
{
case Culture.Ru:
s += ValueToString(timeSpan.Days, "дней", "день", "дня");
s += " " + ValueToString(timeSpan.Hours, "часов", "час", "часа");
s = s.Trim();
s += " " + ValueToString(timeSpan.Minutes, "минут", "минута", "минуты");
s = s.Trim();
s += " " + ValueToString(timeSpan.Seconds, "секунд", "секунда", "секунды");
s = s.Trim();
break;
default:
s += ValueToString(timeSpan.Days, "day", "days");
s += " " + ValueToString(timeSpan.Hours, "hour", "hours");
s = s.Trim();
s += " " + ValueToString(timeSpan.Minutes, "minute", "minutes");
s = s.Trim();
s += " " + ValueToString(timeSpan.Seconds, "second", "seconds");
s = s.Trim();
break;
}
return s;
}
示例2: ExtendedSearch
public static ExtendedSearch ExtendedSearch(ExtendedSearch search, out int? max, Culture culture)
{
max = 0;
if (search == null)
return new ExtendedSearch(culture);
if (!search.NeedToSearch)
return search;
int? type = search.CurrentPlaceType;
if (type == -1)
type = null;
switch (search.CurrentSearchItem)
{
case (int)SearchItem.Region:
Country country;
search.Regions = DataManager.Regions.GetRegions(null, search.Page, ItemsPerPage, out max, out country, culture, search.Name, SearchOrder.GetOrder(search.CurrentSearchOrder));
return search;
case (int)SearchItem.Place:
Region region;
search.Places = DataManager.Places.GetPlaces(null, search.Page, ItemsPerPage, out max, out region, culture, search.Name, type, SearchOrder.GetOrder(search.CurrentSearchOrder));
return search;
case (int)SearchItem.Route:
search.Routes = DataManager.Routes.GetPublicRoutes(search.Page, ItemsPerPage, out max, culture, search.Name, SearchOrder.GetOrder(search.CurrentSearchOrder));
return search;
default:
search.Countries = DataManager.Countries.GetCountries(search.Page, ItemsPerPage, out max, culture, search.Name, SearchOrder.GetOrder(search.CurrentSearchOrder));
return search;
}
}
示例3: SRegion
public SRegion(HttpContextBase context, Region region, Culture culture = Culture.En)
{
Id = region.Id;
Name = region.GetName(culture);
Rating = region.Rating;
Image = DefineImagePath(context, region.Image);
}
示例4: BtnSave_Click
protected void BtnSave_Click(object sender, EventArgs e)
{
LblErr.Text = "";
LblOk.Text = "";
try
{
Culture o1 = new Culture();
if (base.CurrentKey == "")
{
form2obj(o1);
o1 = new CulturesManager().Insert(o1);
}
else
{
o1 = new CulturesManager().GetByKey(base.CurrentKey); //precarico i campi esistenti e nn gestiti dal form
form2obj(o1);
new CulturesManager().Update(o1);
}
Grid1.DataBind();
LblOk.Text = Utility.GetLabel("RECORD_SAVED_MSG");
MultiView1.ActiveViewIndex = 0;
}
catch (Exception e1)
{
LblErr.Text = Utility.GetLabel("RECORD_ERR_MSG") + "<br />" + e1.ToString();
}
finally
{
}
}
示例5: SCountry
private SCountry(HttpContextBase context, Country country, Culture culture = Culture.En)
{
Id = country.Id;
Name = country.GetName(culture);
Image = DefineImagePath(context, country.Image);
Rating = country.Rating;
}
示例6: ChangeCulture
public ActionResult ChangeCulture(Culture lang, string returnUrl)
{
if (returnUrl.Length >= 3)
{
returnUrl = returnUrl.Substring(3);
}
return Redirect("/" + lang.ToString() + returnUrl);
}
示例7: GetCultureName_Returns_Valid_Result
public void GetCultureName_Returns_Valid_Result(Culture culture, string cultureName, int cultureLcid)
{
string name = null;
Assert.That(() => name = culture.GetCultureName(), Throws.Nothing);
Assert.That(name, Is.Not.Null);
Assert.That(name, Is.EqualTo(cultureName));
}
示例8: SRouteExtended
public SRouteExtended(Route route, IEnumerable<SCheckPoint> checkPoints, Culture culture)
: base(route, checkPoints, culture)
{
NumberOfCheckPoints = route.CheckPoints.Count;
AverageTime = route.AverageTime;
AverageTimeFormatted = route.FormatAverageTime(culture);
AuthorName = route.User.FullName;
}
示例9: SPlaceExtended
public SPlaceExtended(HttpContextBase context, Place place, Culture culture = Culture.En)
: base(context, place, culture)
{
Type = PlaceTypes.GetPlaceType(place.TypeId).GetName(culture);
Description = place.GetDescription(culture);
RegionId = place.RegionId;
RegionName = place.Region.GetName(culture);
}
示例10: GetAll
public static IEnumerable<Status> GetAll(Culture culture)
{
return new[]
{
Hidden,
Private,
Public
};
}
示例11: SPlace
public SPlace(HttpContextBase context, Place place, Culture culture = Culture.En)
{
Id = place.Id;
Name = place.GetName(culture);
Rating = place.Rating;
X = place.X;
Y = place.Y;
Image = DefineImagePath(context, place.Image);
}
示例12: SRoute
public SRoute(Route route, IEnumerable<SCheckPoint> checkPoints, Culture culture)
{
Id = route.Id;
Name = route.GetName(culture);
Rating = route.RelativeRating;
AuthorId = route.Author;
Status = RouteStatus.GetStatus(route.Status).GetName(culture);
CheckPoints = checkPoints;
}
示例13: GetAll
public static IEnumerable<Status> GetAll(Culture culture)
{
return new[]
{
Default,
Name,
Popularity
};
}
示例14: GetCultureInfo_Returns_Valid_Result
public void GetCultureInfo_Returns_Valid_Result(Culture culture, string cultureName, int cultureLcid)
{
CultureInfo cultureInfo = null;
Assert.That(() => cultureInfo = culture.GetCultureInfo(), Throws.Nothing);
Assert.That(cultureInfo, Is.Not.Null);
Assert.That(cultureInfo.LCID, Is.EqualTo(cultureLcid));
Assert.That(cultureInfo.Name, Is.EqualTo(cultureName));
}
示例15: OrderAscending
public static IEnumerable<Country> OrderAscending(IEnumerable<Country> countries, Culture culture)
{
switch (culture)
{
case Culture.Ru:
return countries.OrderBy(x => x.Translation.Ru);
default:
return countries.OrderBy(x => x.Translation.En);
}
}