Sage.SageContext.GetProjectVariable C# (CSharp) Method

GetProjectVariable() public method

Gets the value of the project variable with the specified name.
public GetProjectVariable ( string name, string locale = null ) : string
name string The name of the variable.
locale string Optional locale to use to select the variable value. If omitted the current will be used
return string
        public string GetProjectVariable(string name, string locale = null)
        {
            if (string.IsNullOrWhiteSpace(locale) || !this.ProjectConfiguration.Locales.ContainsKey(locale))
                locale = this.Locale;

            return this.ProjectConfiguration.GetVariable(name, locale);
        }

Usage Example

Esempio n. 1
0
        internal static string GetVariable(SageContext context, params string[] arguments)
        {
            if (arguments.Length < 1)
                return string.Empty;

            string name = arguments[0];
            string locale = arguments.Length < 2 ? null : arguments[1];

            return context.GetProjectVariable(name, locale);
        }