private void ProcessNutrients()
 {
     if (_currentProduct.NutrimentsDictionary != null)
     {
         var subcategoryNames = new List <string> {
             "saturaged-fat"
         };
         //var nutrients = new List<NutrientViewModel>();
         foreach (var item in _currentProduct.NutrimentsDictionary)
         {
             if (!item.Key.Contains("sodium") && !item.Key.Contains("score"))
             {
                 if (item.Key.EndsWith("_100g"))
                 {
                     // get unit
                     var    name        = item.Key.Replace("_100g", "");
                     var    displayName = name;
                     var    unitKey     = item.Key.Replace("_100g", "_unit");
                     string unitValue   = "";
                     bool   subCategory = false;
                     _currentProduct.NutrimentsDictionary.TryGetValue(unitKey, out unitValue);
                     if (subcategoryNames.Contains(item.Key))
                     {
                         subCategory = true;
                     }
                     var nutrientViewModel = new NutrientViewModel(item.Key, item.Value, unitValue, subCategory, 1);
                     //displayName = TranslateNutrient(nutrientTranslator, name, displayName, nutrientViewModel);
                     //nutrients.Add(nutrientViewModel);
                     Product.Nutrients.Add(nutrientViewModel);
                 }
             }
         }
     }
 }
        private string TranslateNutrient(NutrientLanguageNames nutrientTranslator, string name, string displayName, NutrientViewModel nutrientViewModel)
        {
            var nutrientTranslations = nutrientTranslator.TranslateNutrient(name, "label", this.LanguageCode);

            if (nutrientTranslations.Any())
            {
                displayName                     = nutrientTranslations.First().Name;
                nutrientViewModel.Order         = nutrientTranslations.First().Order;
                nutrientViewModel.IsSubCategory = !(nutrientViewModel.Order == 1 || nutrientViewModel.Order % 10 == 0);
            }
            nutrientViewModel.DisplayName = displayName;
            return(displayName);
        }
        private string TranslateNutrient(NutrientLanguageNames nutrientTranslator, string name, string displayName, NutrientViewModel nutrientViewModel)
        {
            var nutrientTranslations = nutrientTranslator.TranslateNutrient(name, "label", Product.LanguageCode);
            int order = 1;

            if (nutrientTranslations.Any())
            {
                displayName = nutrientTranslations.First().Name;
                order       = nutrientTranslations.First().Order;
            }
            nutrientViewModel.DisplayName = displayName;
            return(displayName);
        }