예제 #1
0
        public void GetPropertiesToTranslate()
        {
            translateCategories.Items.Clear();
            allCategories.Name = allText.Text;
            translateCategories.Items.Add(allCategories);

            string currentTranslation = GitCommands.Settings.Translation;

            try
            {
                //Set language to neutral to get neutral translations
                GitCommands.Settings.Translation = "";

                List <Type> translatableTypes = TranslationUtl.GetTranslatableTypes();

                foreach (Type type in translatableTypes)
                {
                    ITranslate obj = CreateInstanceOfClass(type) as ITranslate;
                    if (obj != null)
                    {
                        obj.AddTranslationItems(neutralTranslation);
                    }
                }
            }
            finally
            {
                neutralTranslation.Sort();
                translateCategories.Items.AddRange(neutralTranslation.GetTranslationCategories().ToArray());
                //Restore translation
                GitCommands.Settings.Translation = currentTranslation;
            }
        }
예제 #2
0
        public void CreateInstanceOfClass()
        {
            // just reference to GitUI
            MouseWheelRedirector.Active = true;

            var translatableTypes = TranslationUtl.GetTranslatableTypes();

            var testTranslation = new Dictionary <string, TranslationFile>();

            foreach (var types in translatableTypes)
            {
                var tranlation = new TranslationFile();
                foreach (Type type in types.Value)
                {
                    try
                    {
                        ITranslate obj = TranslationUtl.CreateInstanceOfClass(type) as ITranslate;
                        obj.AddTranslationItems(tranlation);
                        obj.TranslateItems(tranlation);
                    }
                    catch (Exception)
                    {
                        Trace.WriteLine("Problem with class: " + type.FullName);
                        throw;
                    }
                }

                testTranslation[types.Key] = tranlation;
            }
        }
예제 #3
0
        public static IList <TranslationItemWithCategory> LoadNeutralItems()
        {
            Translation neutralTranslation = new Translation();

            try
            {
                //Set language to neutral to get neutral translations
                GitCommands.Settings.CurrentTranslation = "";

                List <Type> translatableTypes = TranslationUtl.GetTranslatableTypes();
                foreach (Type type in translatableTypes)
                {
                    ITranslate obj = TranslationUtl.CreateInstanceOfClass(type) as ITranslate;
                    if (obj != null)
                    {
                        obj.AddTranslationItems(neutralTranslation);
                    }
                }
            }
            finally
            {
                neutralTranslation.Sort();

                //Restore translation
                GitCommands.Settings.CurrentTranslation = null;
            }

            IList <TranslationItemWithCategory> neutralItems =
                (from translationCategory in neutralTranslation.GetTranslationCategories()
                 from translationItem in translationCategory.GetTranslationItems()
                 select new TranslationItemWithCategory(translationCategory.Name, translationItem)).ToList();

            return(neutralItems);
        }
예제 #4
0
        private void FillNeutralTranslation(Translation neutralTranslation)
        {
            try
            {
                //Set language to neutral to get neutral translations
                GitCommands.Settings.CurrentTranslation = "";
                Translate();

                List <Type> translatableTypes = TranslationUtl.GetTranslatableTypes();

                foreach (Type type in translatableTypes)
                {
                    ITranslate obj = CreateInstanceOfClass(type) as ITranslate;
                    if (obj != null)
                    {
                        obj.AddTranslationItems(neutralTranslation);
                    }
                }
            }
            finally
            {
                neutralTranslation.Sort();

                //Restore translation
                GitCommands.Settings.CurrentTranslation = null;
                Translate();
            }
        }
예제 #5
0
 public virtual void AddTranslationItems(Translation translation)
 {
     if (!string.IsNullOrEmpty(Text))
     {
         translation.AddTranslationItem(Name, "$this", "Text", Text);
     }
     TranslationUtl.AddTranslationItemsFromFields(Name, this, translation);
 }
예제 #6
0
 public object CreateInstanceOfClass(Type type)
 {
     if (type == GetType())
     {
         return(this);
     }
     else
     {
         return(TranslationUtl.CreateInstanceOfClass(type));
     }
 }
예제 #7
0
        private void FillNeutralTranslation()
        {
            try
            {
                //Set language to neutral to get neutral translations
                GitCommands.Settings.CurrentTranslation = "";

                List <Type> translatableTypes = TranslationUtl.GetTranslatableTypes();
                progressBar.Maximum = translatableTypes.Count;
                progressBar.Visible = true;

                for (int index = 0; index < translatableTypes.Count; index++)
                {
                    Type       type = translatableTypes[index];
                    ITranslate obj  = TranslationUtl.CreateInstanceOfClass(type) as ITranslate;
                    if (obj != null)
                    {
                        obj.AddTranslationItems(neutralTranslation);
                    }

                    progressBar.Value = index;
                    if (index % 10 == 0)
                    {
                        Update();
                    }
                }
            }
            finally
            {
                neutralTranslation.Sort();

                //Restore translation
                GitCommands.Settings.CurrentTranslation = null;
                progressBar.Visible = false;
            }
        }
        public void CreateInstanceOfClass()
        {
            // just reference to GitUI
            MouseWheelRedirector.Active = true;

            List <Type> translatableTypes = TranslationUtl.GetTranslatableTypes();

            var testTranslation = new Translation();

            foreach (Type type in translatableTypes)
            {
                try
                {
                    ITranslate obj = TranslationUtl.CreateInstanceOfClass(type) as ITranslate;
                    obj.AddTranslationItems(testTranslation);
                    obj.TranslateItems(testTranslation);
                }
                catch (System.Exception)
                {
                    Trace.WriteLine("Problem with class: " + type.FullName);
                    throw;
                }
            }
        }
예제 #9
0
 public virtual void TranslateItems(Translation translation)
 {
     TranslationUtl.TranslateItemsFromFields(Name, this, translation);
 }
예제 #10
0
 public virtual void AddTranslationItems(Translation translation)
 {
     TranslationUtl.AddTranslationItemsFromFields(GetType().Name, this, translation);
 }
예제 #11
0
 public override void TranslateItems(Translation translation)
 {
     base.TranslateItems(translation);
     TranslationUtl.TranslateItemsFromFields(FormBrowseName, filterRevisionsHelper, translation);
     TranslationUtl.TranslateItemsFromFields(FormBrowseName, filterBranchHelper, translation);
 }
예제 #12
0
 public virtual void TranslateItems(Translation translation)
 {
     Text = translation.TranslateItem(Name, "$this", "Text", Text);
     TranslationUtl.TranslateItemsFromFields(Name, this, translation);
 }
예제 #13
0
 public virtual void TranslateItems(Translation translation)
 {
     TranslationUtl.TranslateItemsFromList("FormBrowse", translation, GetAdditionalMainMenuItemsForTranslation());
 }
예제 #14
0
 public virtual void TranslateItems(Translation translation)
 {
     TranslationUtl.TranslateItemsFromFields(ProxySwitcherFormName, this, translation);
 }
예제 #15
0
 public virtual void TranslateItems(Translation translation)
 {
     TranslationUtl.TranslateItemsFromFields(TranslationCategoryName, this, translation);
     TranslationUtl.TranslateItemsFromList(TranslationCategoryName, translation, GetMenuCommandsForTranslationImpl());
 }