コード例 #1
0
        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);
        }
コード例 #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;
        }
コード例 #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);
        }
コード例 #4
0
 internal I18n GetLanguageService(LanguageInfo language)
 {
     return new I18n(language.CompatibleGherkinLanguage ?? language.Language);
 }
コード例 #5
0
 internal GherkinDialect(LanguageInfo languageInfo, I18n nativeLanguageService)
 {
     NativeLanguageService = nativeLanguageService;
     LanguageInfo = languageInfo;
 }
コード例 #6
0
 internal GherkinDialect GetGherkinDialect(LanguageInfo language)
 {
     return new GherkinDialect(language, 
         new I18n(language.CompatibleGherkinLanguage ?? language.Language));
 }
コード例 #7
0
 internal GherkinDialect GetGherkinDialect(LanguageInfo language)
 {
     return(new GherkinDialect(language,
                               new I18n(language.CompatibleGherkinLanguage ?? language.Language)));
 }
コード例 #8
0
 internal GherkinDialect(LanguageInfo languageInfo, I18n nativeLanguageService)
 {
     NativeLanguageService = nativeLanguageService;
     LanguageInfo          = languageInfo;
 }
コード例 #9
0
 public override int GetHashCode()
 {
     return LanguageInfo.GetHashCode();
 }
コード例 #10
0
        public override bool Equals(object obj)
        {
            LanguageInfo other = obj as LanguageInfo;

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