internal LanguageInfo GetLanguage(string fileContent)
        {
            string langName  = defaultLanguage.Name;
            var    langMatch = languageRe.Match(fileContent);

            if (langMatch.Success)
            {
                langName = langMatch.Groups["lang"].Value;
            }

            LanguageInfo languageInfo =
                SupportedLanguageHelper.GetSupportedLanguage(langName);

            return(languageInfo);
        }
Exemplo n.º 2
0
        private static LanguageInfo LoadLangInfo(XElement langElm, string requestedLanguageName)
        {
            var langInfo = new LanguageInfo();
            langInfo.Language = langElm.Attribute(XName.Get("code", "")).Value;
            langInfo.CultureInfo = CultureInfo.GetCultureInfo(langElm.Attribute(XName.Get("cultureInfo", "")).Value);

            var gherkinCodeAttr = langElm.Attribute(XName.Get("compatibleGherkinCode", ""));
            if (gherkinCodeAttr != null)
                langInfo.CompatibleGherkinLanguage = gherkinCodeAttr.Value;

            if (langInfo.CultureInfo.IsNeutralCulture)
            {
                langInfo.LanguageForConversions = GetLanguageForConversions(langElm, requestedLanguageName);
            }
            else
            {
                langInfo.LanguageForConversions = langInfo.CultureInfo;
            }
            return langInfo;
        }
Exemplo n.º 3
0
        private static LanguageInfo LoadLangInfo(XElement langElm, string requestedLanguageName)
        {
            var langInfo = new LanguageInfo();

            langInfo.Language    = langElm.Attribute(XName.Get("code", "")).Value;
            langInfo.CultureInfo = CultureInfo.GetCultureInfo(langElm.Attribute(XName.Get("cultureInfo", "")).Value);

            var gherkinCodeAttr = langElm.Attribute(XName.Get("compatibleGherkinCode", ""));

            if (gherkinCodeAttr != null)
            {
                langInfo.CompatibleGherkinLanguage = gherkinCodeAttr.Value;
            }

            if (langInfo.CultureInfo.IsNeutralCulture)
            {
                langInfo.LanguageForConversions = GetLanguageForConversions(langElm, requestedLanguageName);
            }
            else
            {
                langInfo.LanguageForConversions = langInfo.CultureInfo;
            }
            return(langInfo);
        }
Exemplo n.º 4
0
 internal I18n GetLanguageService(LanguageInfo language)
 {
     return new I18n(language.CompatibleGherkinLanguage ?? language.Language);
 }
Exemplo n.º 5
0
 internal GherkinDialect(LanguageInfo languageInfo, I18n nativeLanguageService)
 {
     NativeLanguageService = nativeLanguageService;
     LanguageInfo = languageInfo;
 }
 internal GherkinDialect GetGherkinDialect(LanguageInfo language)
 {
     return new GherkinDialect(language, 
         new I18n(language.CompatibleGherkinLanguage ?? language.Language));
 }
Exemplo n.º 7
0
 internal GherkinDialect GetGherkinDialect(LanguageInfo language)
 {
     return(new GherkinDialect(language,
                               new I18n(language.CompatibleGherkinLanguage ?? language.Language)));
 }
Exemplo n.º 8
0
 internal GherkinDialect(LanguageInfo languageInfo, I18n nativeLanguageService)
 {
     NativeLanguageService = nativeLanguageService;
     LanguageInfo          = languageInfo;
 }
Exemplo n.º 9
0
 public override int GetHashCode()
 {
     return LanguageInfo.GetHashCode();
 }
Exemplo n.º 10
0
        public override bool Equals(object obj)
        {
            LanguageInfo other = obj as LanguageInfo;

            return(other != null && other.Language.Equals(Language));
        }