MapSuiteGisEditor/GisEditorInfrastructure/Managers/LanguageManager/LanguageManager.cs
/// <summary>
/// Sets the current language core.
/// </summary>
/// <param name="language">The language.</param>
Sets the current language core.
Sets the current language core .
protected virtual void SetCurrentLanguageCore(CultureInfo language)
        {
            SetFlowDirection(language);
            GetDefaultLanguageUris().ForEach(tempUri => SetDefaultResource(tempUri));
            LanguageSetting.Instance.Language = language;
            var currentLanguageFolderPath = Path.Combine(PluginHelper.GetEntryPath(), "languages", LanguageSetting.Instance.Language.Name);
            if (Application.Current == null) return;
            var nonDefaultResources = Application.Current.Resources.MergedDictionaries
                .Where(md => md.Source.OriginalString.Contains("/languages/") && !GetDefaultLanguageUris().Any(tempUri => md.Source.OriginalString.Equals(tempUri))).ToArray();
            foreach (ResourceDictionary item in nonDefaultResources)
            {
                Application.Current.Resources.MergedDictionaries.Remove(item);
            }
            if (Directory.Exists(currentLanguageFolderPath))
            {
                foreach (var item in Directory.GetFiles(currentLanguageFolderPath, "*.xaml", SearchOption.AllDirectories))
                {
                    Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary { Source = new Uri(item.Replace(@"\", "/"), UriKind.RelativeOrAbsolute) });
                }
            }
        }
protected virtual void SetCurrentLanguageCore ( CultureInfo language ) { SetFlowDirection ( language ) ; GetDefaultLanguageUris ( ) . ForEach ( tempUri => SetDefaultResource ( tempUri ) ) ; LanguageSetting . Instance . Language = language ; var currentLanguageFolderPath = Path . Combine ( PluginHelper . GetEntryPath ( ) , " " , LanguageSetting . Instance . Language . Name ) ; if ( Application . Current == null ) return ; var nonDefaultResources = Application . Current . Resources . MergedDictionaries . Where ( md => md . Source . OriginalString . Contains ( " " ) && ! GetDefaultLanguageUris ( ) . Any ( tempUri => md . Source . OriginalString . Equals ( tempUri ) ) ) . ToArray ( ) ; foreach ( ResourceDictionary item in nonDefaultResources ) { Application . Current . Resources . MergedDictionaries . Remove ( item ) ; } if ( Directory . Exists ( currentLanguageFolderPath ) ) { foreach ( var item in Directory . GetFiles ( currentLanguageFolderPath , " " , SearchOption . AllDirectories ) ) { Application . Current . Resources . MergedDictionaries . Add ( new ResourceDictionary { Source = new Uri ( item . Replace ( @"\" , " " ) , UriKind . RelativeOrAbsolute ) } ) ; } } }
Sets the current language core.
Sets the current language core .
language
CultureInfo
None