Sage.Configuration.ProjectConfiguration.GetVariable C# (CSharp) Method

GetVariable() public method

Gets the value of the project variable with the specified name.
public GetVariable ( string name, string locale = null ) : string
name string The name of the variable.
locale string Optional locale to use to select the variable value.
return string
        public string GetVariable(string name, string locale = null)
        {
            NameValueCollection variable;
            if (!this.Variables.TryGetValue(name, out variable))
                return null;

            var result = variable["default"];
            if (locale != null && this.Locales.ContainsKey(locale))
            {
                var localeInfo = this.Locales[locale];
                foreach (string localeName in localeInfo.ResourceNames)
                {
                    if (variable[localeName] != null)
                    {
                        result = variable[localeName];
                        break;
                    }
                }
            }

            return result;
        }