How to get a localized value?

1 month ago
How to get a localized value? This function returns knowledge only in Russian.


string catValue = "";
          try
                {
                    catId = Convert.ToInt32(doc.XPathSelectElement("//ProductAttribute[@ID='1']/ProductAttributeValue/Value").Value);
                    catValue = $"{_productAttributeService.GetProductAttributeValueById(catId).Name}";                    
                }
                catch { }
1 month ago
Your question is not clear to me. Can you please write in details here?
1 month ago
mhsjaber wrote:
Your question is not clear to me. Can you please write in details here?


the ProductAttributeValue table stores attribute values in Russian. How can I use this function
_productAttributeService.GetProductAttributeValueById

from the box to return a localized value?
1 month ago
Try this.

var productAttributeValue = _productAttributeService.GetProductAttributeValueById(attributeValueId);

var name = _localizationService.GetLocalized(productAttributeValue, x => x.Name, lang.Id, false, false);
1 month ago
mhsjaber wrote:
Try this.

var productAttributeValue = _productAttributeService.GetProductAttributeValueById(attributeValueId);

var name = _localizationService.GetLocalized(productAttributeValue, x => x.Name, lang.Id, false, false);


Error  CS1501  No overload for method 'GetLocalized' takes 5 arguments
1 month ago
What is your nopCommerce version?
1 month ago
mhsjaber wrote:
What is your nopCommerce version?


3.9
1 month ago
Ok, then try this.

var name = productAttributeValue.GetLocalized(x => x.Name, lang.Id, false, false);
1 month ago
mhsjaber wrote:
Ok, then try this.

var name = productAttributeValue.GetLocalized(x => x.Name, lang.Id, false, false);


The name 'lang' does not exist in the current context
The name 'productAttributeValue' does not exist in the current context
1 month ago
Try this
var productAttributeValue = _productAttributeService.GetProductAttributeValueById(attributeValueId);

var name = productAttributeValue.GetLocalized(x => x.Name, _workContext.WorkingLanguage.Id, false, false);