MapSuiteGisEditor/GisEditorInfrastructure/Managers/LanguageManager/LanguageManager.cs
/// <summary>
/// Gets the string resource core.
/// </summary>
/// <param name="key">The key.</param>
/// <returns></returns>
Gets the string resource core.
Gets the string resource core .
protected virtual string GetStringResourceCore(string key)
        {
            if (Application.Current != null && Application.Current.Resources.Contains(key)) return Application.Current.Resources[key].ToString();
            else
            {
                var currentLanguageFolderPath = Path.Combine(PluginHelper.GetEntryPath(), "languages", LanguageSetting.Instance.Language.Name);
                ResourceDictionary rd = new ResourceDictionary();
                if (Directory.Exists(currentLanguageFolderPath))
                {
                    foreach (var item in Directory.GetFiles(currentLanguageFolderPath, "*.xaml", SearchOption.AllDirectories))
                    {
                        rd.MergedDictionaries.Add(new ResourceDictionary { Source = new Uri(item.Replace(@"\", "/"), UriKind.RelativeOrAbsolute) });
                    }
                    if (rd.Contains(key)) return rd[key].ToString();
                    else return string.Empty;
                }
                else
                {
                    return string.Empty;
                }
            }
        }
protected virtual string GetStringResourceCore ( string key ) { if ( Application . Current != null && Application . Current . Resources . Contains ( key ) ) return Application . Current . Resources [ key ] . ToString ( ) ; else { var currentLanguageFolderPath = Path . Combine ( PluginHelper . GetEntryPath ( ) , " " , LanguageSetting . Instance . Language . Name ) ; ResourceDictionary rd = new ResourceDictionary ( ) ; if ( Directory . Exists ( currentLanguageFolderPath ) ) { foreach ( var item in Directory . GetFiles ( currentLanguageFolderPath , " " , SearchOption . AllDirectories ) ) { rd . MergedDictionaries . Add ( new ResourceDictionary { Source = new Uri ( item . Replace ( @"\" , " " ) , UriKind . RelativeOrAbsolute ) } ) ; } if ( rd . Contains ( key ) ) return rd [ key ] . ToString ( ) ; else return string . Empty ; } else { return string . Empty ; } } }
Gets the string resource core.
Gets the string resource core .
None
key
string
None