예제 #1
0
        private WordpressSettings()
        {
            CultureInfo currentCulture = Thread.CurrentThread.CurrentUICulture;
            string      map            = MarketizationOptions.GetFeatureParameter(MarketizationOptions.Feature.Wordpress, MarketizationOptions.WordpressParameters.LanguageMapping);
            string      mapTo          = null;

            if (!string.IsNullOrEmpty(map))
            {
                string[] mapSplit = map.Split(',');
                for (int i = 1; i < mapSplit.Length; i += 2)
                {
                    // in our mapping table (markets.xml), if the "from" entry is longer than two chars, we compare it against
                    // the current UI culture *name*, not the current UI culture *TwoLetterISOLanguageName*.
                    string mapFrom = mapSplit[i - 1].Trim();
                    string currentCultureIdOrLanguage = mapFrom.Length > 2 ? currentCulture.Name : currentCulture.TwoLetterISOLanguageName;

                    if (string.Compare(mapFrom, currentCultureIdOrLanguage, StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        mapTo = mapSplit[i].Trim();
                        break;
                    }
                }
            }

            // If no mapping, by default we use the current culture's two-letter-ISO-langauge-name.
            if (mapTo == null)
            {
                mapTo = currentCulture.TwoLetterISOLanguageName;
            }

            string url = string.Format(CultureInfo.InvariantCulture, MarketizationOptions.GetFeatureParameter(MarketizationOptions.Feature.Wordpress, MarketizationOptions.WordpressParameters.SignupUrl), mapTo);

            this.uri = new Uri(url);
        }
예제 #2
0
 private string GetGLink(MarketizationOptions.Feature id, string queryString, string paramName)
 {
     string glink = MarketizationOptions.GetFeatureParameter(id, paramName);
     return FixUpGLink(glink, queryString);
 }
예제 #3
0
 private string GetGLink(MarketizationOptions.Feature id, string queryString)
 {
     return GetGLink(id, queryString, "Glink");
 }
예제 #4
0
 private string GetGLink(MarketizationOptions.Feature id)
 {
     return GetGLink(id, null);
 }