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;
        }
Esempio n. 2
0
        private void FillNeutralTranslation(Translation neutralTranslation)
        {
            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();
                //Restore translation
                GitCommands.Settings.Translation = currentTranslation;
            }
        }