Exemple #1
0
 public Alert(string category = null)
 {
     AlertDate = DateTime.Now;
     if (category == "Driftsmelding")
     {
         EffectiveDate = AlertDate;
     }
     else
     {
         EffectiveDate = DateTime.Now.AddMonths(3);
     }
     Translations = new TranslationCollection <AlertTranslation>();
 }
Exemple #2
0
 public ActionResult Save(Bam.Net.Translation.Translation[] values)
 {
     try
     {
         TranslationCollection saver = new TranslationCollection();
         saver.AddRange(values);
         saver.Save();
         return(Json(new { Success = true, Message = "", Dao = "" }));
     }
     catch (Exception ex)
     {
         return(GetErrorResult(ex));
     }
 }
		public TranslationProject ()
		{
			translations = new TranslationCollection (this);
			
			//NOTE: we don't really need multiple configurations for this project type, since nothing actually uses them
			//but it makes the solution configuration mapping look more consistent
			//Perhaps in future there will be some per-config settings
			foreach (string config in new [] { "Debug", "Release"})
				Configurations.Add (new TranslationProjectConfiguration (config));
		}
        private void SaveInternal(TranslationCollection translations, Dictionary <int, string> DisplayFolderLanguages, Dictionary <int, string> DescriptionLanguages, SSAS.TabularTranslationObjectAnnotation annotation)
        {
            List <int> listAllLanguages = new List <int>(Languages.Keys);

            foreach (int iLang in DisplayFolderLanguages.Keys)
            {
                if (!listAllLanguages.Contains(iLang))
                {
                    listAllLanguages.Add(iLang);
                }
            }
            foreach (int iLang in DescriptionLanguages.Keys)
            {
                if (!listAllLanguages.Contains(iLang))
                {
                    listAllLanguages.Add(iLang);
                }
            }

            List <SSAS.TabularTranslationAnnotation> listAnnotations = new List <TabularTranslationAnnotation>();

            translations.Clear();
            foreach (int iLang in listAllLanguages)
            {
                Translation t = new Translation(iLang);
                if (translations is AttributeTranslationCollection)
                {
                    t = new AttributeTranslation(iLang);
                }
                if (DisplayFolderLanguages.ContainsKey(iLang))
                {
                    t.DisplayFolder = DisplayFolderLanguages[iLang];
                }
                if (DescriptionLanguages.ContainsKey(iLang))
                {
                    t.Description = DescriptionLanguages[iLang];
                }

                if (Languages.ContainsKey(iLang) && !string.IsNullOrEmpty(Languages[iLang]))
                {
                    t.Caption = Languages[iLang];
                }
                else if (!string.IsNullOrEmpty(t.DisplayFolder) || !string.IsNullOrEmpty(t.Description))
                {
                    t.Caption = this.DefaultLanguage; //this works around a problem where if they translate the display folder or the description but not the caption, then the caption ends up blank
                }
                if (!string.IsNullOrEmpty(t.Caption) || !string.IsNullOrEmpty(t.Description) || !string.IsNullOrEmpty(t.DisplayFolder))
                {
                    translations.Add(t);
                    SSAS.TabularTranslationAnnotation tranAnnotation = new TabularTranslationAnnotation();
                    tranAnnotation.Caption       = t.Caption;
                    tranAnnotation.Description   = t.Description;
                    tranAnnotation.DisplayFolder = t.DisplayFolder;
                    tranAnnotation.Language      = t.Language;
                    listAnnotations.Add(tranAnnotation);
                }
            }

            if (annotation != null)
            {
                annotation.TabularTranslations = listAnnotations.ToArray();
            }
        }
		public TranslationProject ()
		{
			translations = new TranslationCollection (this);
		}
Exemple #6
0
 public Alert()
 {
     AlertDate     = DateTime.Now;
     EffectiveDate = DateTime.Now.AddMonths(3);
     Translations  = new TranslationCollection <AlertTranslation>();
 }
		public TranslationProject ()
		{
			Initialize (this);
			translations = new TranslationCollection (this);
		}
Exemple #8
0
 public Theme()
 {
     Translations = new TranslationCollection <ThemeTranslation>();
 }
        private void SaveInternal(TranslationCollection translations, Dictionary<int, string> DisplayFolderLanguages, Dictionary<int, string> DescriptionLanguages, SSAS.TabularTranslationObjectAnnotation annotation)
        {
            List<int> listAllLanguages = new List<int>(Languages.Keys);
            foreach (int iLang in DisplayFolderLanguages.Keys)
            {
                if (!listAllLanguages.Contains(iLang))
                    listAllLanguages.Add(iLang);
            }
            foreach (int iLang in DescriptionLanguages.Keys)
            {
                if (!listAllLanguages.Contains(iLang))
                    listAllLanguages.Add(iLang);
            }

            List<SSAS.TabularTranslationAnnotation> listAnnotations = new List<TabularTranslationAnnotation>();
            translations.Clear();
            foreach (int iLang in listAllLanguages)
            {
                Translation t = new Translation(iLang);
                if (translations is AttributeTranslationCollection)
                    t = new AttributeTranslation(iLang);
                if (DisplayFolderLanguages.ContainsKey(iLang))
                    t.DisplayFolder = DisplayFolderLanguages[iLang];
                if (DescriptionLanguages.ContainsKey(iLang))
                    t.Description = DescriptionLanguages[iLang];

                if (Languages.ContainsKey(iLang) && !string.IsNullOrEmpty(Languages[iLang]))
                    t.Caption = Languages[iLang];
                else if (!string.IsNullOrEmpty(t.DisplayFolder) || !string.IsNullOrEmpty(t.Description))
                    t.Caption = this.DefaultLanguage; //this works around a problem where if they translate the display folder or the description but not the caption, then the caption ends up blank
                
                if (!string.IsNullOrEmpty(t.Caption) || !string.IsNullOrEmpty(t.Description) || !string.IsNullOrEmpty(t.DisplayFolder))
                {
                    translations.Add(t);
                    SSAS.TabularTranslationAnnotation tranAnnotation = new TabularTranslationAnnotation();
                    tranAnnotation.Caption = t.Caption;
                    tranAnnotation.Description = t.Description;
                    tranAnnotation.DisplayFolder = t.DisplayFolder;
                    tranAnnotation.Language = t.Language;
                    listAnnotations.Add(tranAnnotation);
                }
            }

            if (annotation != null)
                annotation.TabularTranslations = listAnnotations.ToArray();
        }