예제 #1
0
        public async Task SetParameterTranslation(string languageCode, ParameterResource parameterResource, Language defaultLanguage)
        {
            if (Languages.ContainsKey(languageCode) && Languages[languageCode] != defaultLanguage)
            {
                var parameterTranslation = await _translationRepository.GetParameterTranslation(parameterResource.Id, Languages[languageCode]);

                if (parameterTranslation == null)
                {
                    return;
                }
                if (parameterTranslation.Description != null)
                {
                    parameterResource.Description = parameterTranslation.Description;
                }
                if (parameterTranslation.Notes != null)
                {
                    parameterResource.Notes = parameterTranslation.Notes;
                }
                if (parameterTranslation.GroupName != null)
                {
                    parameterResource.GroupName = parameterTranslation.GroupName;
                }
                foreach (var valueOption in parameterResource.ValueOptions)
                {
                    await SetValueOptionTranslation(languageCode, valueOption, defaultLanguage);
                }
            }
            return;
        }