Hello,
I wanted to add an extra local resource so I can later display it when the logic dictates its requirement. For example, I added a local resource that I want to display when the Cart total is less then or equal to zero, such that the wording would be appropriate for the number of items or item in the cart. Right now, the default is always plural.. i.e. "There are {0} in your cart."
I added the extra resource to the DefaultResources.nopres.xml page by copying the existing LocalResource and changing the name and the Value, as posted below:
<LocaleResource Name="ShoppingCart.Mini.ItemText">
<Value>There is {0} in your cart.</Value>
</LocaleResource>
<LocaleResource Name="ShoppingCart.Mini.ItemsText">
<Value>There are {0} in your cart.</Value>
</LocaleResource>
Then, I modified the Default.cshtml page like this:
<div class="count">
@if (Model.TotalProducts == 0)
{
@T("ShoppingCart.Mini.NoItems")
}
else
{
@if (Model.TotalProducts > 1)
{
@Html.Raw(string.Format(T("ShoppingCart.Mini.ItemsText").Text, $"<a href=\"{Url.RouteUrl("ShoppingCart")}\">{string.Format(T("ShoppingCart.Mini.Items").Text, Model.TotalProducts)}</a>"))
}
else
{
@Html.Raw(string.Format(T("ShoppingCart.Mini.ItemText").Text, $"<a href=\"{Url.RouteUrl("ShoppingCart")}\">{string.Format(T("ShoppingCart.Mini.Item").Text, Model.TotalProducts)}</a>"))
}
}
</div>
I was expecting the proper text to be displayed when the Cart Item is = 1 , however, I am getting the actual LocalResource Text (exactly): shoppingcart.mini.itemtext
How do I correct this issue?