Hi there,
I've translated resources to Arabic. Now the question is how can I change directions and paddings (right to left) when user changes the language from English to Arabic?
Thanks in advance
Ali
using Nop.Web.Framework;
@using Nop.Web.Framework;
@using Nop.Core;
@using Nop.Core.Infrastructure;
@{
var workContext = EngineContext.Current.Resolve<IWorkContext>();
string s = workContext.WorkingLanguage.LanguageCulture.ToString();
if (s.CompareTo("he-IL") == 0){
<link href="@Html.ResolveUrl("~/Themes/nopClassic/Content/styles_rtl.css")" rel="stylesheet" type="text/css" />
}else{
<link href="@Html.ResolveUrl("~/Themes/nopClassic/Content/styles.css")" rel="stylesheet" type="text/css" />
}
}
using Nop.Core;
@using Nop.Core.Infrastructure;
@{
var workContext = EngineContext.Current.Resolve<IWorkContext>();
if(workContext.WorkingLanguage!=null)
{
string str = workContext.WorkingLanguage.LanguageCulture;
if(str.CompareTo("he-IL")==0)
{
Layout = "~/Views/Shared/_ColumnsThree_rtl.cshtml";
}
else
{
Layout = "~/Views/Shared/_ColumnsThree_ltr.cshtml";
}
}
}
@RenderBody()
@{
Layout = "~/Views/Shared/_Root.cshtml";
}
@{
//current category ID
int currentCategoryId = 0;
if (Url.RequestContext.RouteData.Values["controller"].ToString().Equals("catalog", StringComparison.InvariantCultureIgnoreCase) &&
Url.RequestContext.RouteData.Values["action"].ToString().Equals("category", StringComparison.InvariantCultureIgnoreCase))
{
currentCategoryId = Convert.ToInt32(Url.RequestContext.RouteData.Values["categoryId"].ToString());
}
//current manufacturer ID
int currentManufacturerId = 0;
if (Url.RequestContext.RouteData.Values["controller"].ToString().Equals("catalog", StringComparison.InvariantCultureIgnoreCase) &&
Url.RequestContext.RouteData.Values["action"].ToString().Equals("manufacturer", StringComparison.InvariantCultureIgnoreCase))
{
currentManufacturerId = Convert.ToInt32(Url.RequestContext.RouteData.Values["manufacturerId"].ToString());
}
}
<div class="master-wrapper-leftside-3">
@if (IsSectionDefined("right"))
{
@RenderSection("right")
}
else
{
@Html.Action("WidgetsByZone", "Widget", new { widgetZone = Nop.Core.Domain.Cms.WidgetZone.BeforeRightSideColumn })
<div class="clear">
</div>
@Html.Action("MiniShoppingCart", "ShoppingCart")
<div class="clear">
</div>
@Html.Action("NewsletterBox", "Newsletter")
<div class="clear">
</div>
@Html.Action("RecentlyViewedProductsBlock", "Catalog")
<div class="clear">
</div>
@Html.Action("PollBlock", "Poll", new { systemKeyword = "RightColumnPoll" })
<div class="clear">
</div>
@Html.Action("WidgetsByZone", "Widget", new { widgetZone = Nop.Core.Domain.Cms.WidgetZone.AfterRightSideColumn })
}
@*
@if (IsSectionDefined("left"))
{
@RenderSection("left")
}
else
{
@Html.Action("WidgetsByZone", "Widget", new { widgetZone = Nop.Core.Domain.Cms.WidgetZone.BeforeLeftSideColumn })
<div class="clear">
</div>
@Html.Action("CategoryNavigation", "Catalog", new { currentCategoryId = currentCategoryId })
<div class="clear">
</div>
@Html.Action("ManufacturerNavigation", "Catalog", new { currentManufacturerId = currentManufacturerId })
<div class="clear">
</div>
@Html.Action("PopularProductTags", "Catalog")
<div class="clear">
</div>
@Html.Action("InfoBlock", "Common")
<div class="clear">
</div>
@Html.Action("PollBlock", "Poll", new { systemKeyword = "LeftColumnPoll" })
<div class="clear">
</div>
@Html.Action("WidgetsByZone", "Widget", new { widgetZone = Nop.Core.Domain.Cms.WidgetZone.AfterLeftSideColumn })
}
*@
</div>
<div class="master-wrapper-center-3">
<div class="master-wrapper-cph-3">
@Html.Action("WidgetsByZone", "Widget", new { widgetZone = Nop.Core.Domain.Cms.WidgetZone.BeforeMainColumn })
@RenderBody()
@Html.Action("WidgetsByZone", "Widget", new { widgetZone = Nop.Core.Domain.Cms.WidgetZone.AfterMainColumn })
</div>
</div>
<div class="master-wrapper-rightside-3">
@if (IsSectionDefined("left"))
{
@RenderSection("left")
}
else
{
@Html.Action("WidgetsByZone", "Widget", new { widgetZone = Nop.Core.Domain.Cms.WidgetZone.BeforeLeftSideColumn })
<div class="clear">
</div>
@Html.Action("CategoryNavigation", "Catalog", new { currentCategoryId = currentCategoryId })
<div class="clear">
</div>
@Html.Action("ManufacturerNavigation", "Catalog", new { currentManufacturerId = currentManufacturerId })
<div class="clear">
</div>
@Html.Action("PopularProductTags", "Catalog")
<div class="clear">
</div>
@Html.Action("InfoBlock", "Common")
<div class="clear">
</div>
@Html.Action("PollBlock", "Poll", new { systemKeyword = "LeftColumnPoll" })
<div class="clear">
</div>
@Html.Action("WidgetsByZone", "Widget", new { widgetZone = Nop.Core.Domain.Cms.WidgetZone.AfterLeftSideColumn })
}
@*
@if (IsSectionDefined("right"))
{
@RenderSection("right")
}
else
{
@Html.Action("WidgetsByZone", "Widget", new { widgetZone = Nop.Core.Domain.Cms.WidgetZone.BeforeRightSideColumn })
<div class="clear">
</div>
@Html.Action("MiniShoppingCart", "ShoppingCart")
<div class="clear">
</div>
@Html.Action("NewsletterBox", "Newsletter")
<div class="clear">
</div>
@Html.Action("RecentlyViewedProductsBlock", "Catalog")
<div class="clear">
</div>
@Html.Action("PollBlock", "Poll", new { systemKeyword = "RightColumnPoll" })
<div class="clear">
</div>
@Html.Action("WidgetsByZone", "Widget", new { widgetZone = Nop.Core.Domain.Cms.WidgetZone.AfterRightSideColumn })
}
*@
</div>
@using Nop.Core;
@using Nop.Core.Infrastructure;
@using Nop.Services.Localization;
@{
string str = EngineContext.Current.Resolve<ILocalizationService>().GetResource("Language.Direction");
if (str.CompareTo("rtl") == 0){
Layout = "~/Views/Shared/_ColumnsThree_rtl.cshtml";
}else{
Layout = "~/Views/Shared/_ColumnsThree_ltr.cshtml";
}
}
}