コード例 #1
0
 public ActionResult CreateLanguage(string lang)
 {
     try
     {
         _repository.CreateLanguage(new CultureInfo(lang), DefaultUICulture.Value);
         return RedirectToAction("Index", new { lang });
     }
     catch (Exception err)
     {
         ModelState.AddModelError("", err.Message);
         var allPrompts = _repository.GetPrompts(CultureInfo.CurrentUICulture, DefaultUICulture.Value,
                                                 new SearchFilter());
         var model = new IndexModel
                         {
                             Cultures = _repository.GetAvailableLanguages(),
                             Prompts = allPrompts.Select(p => new Models.LocalizeTypes.TypePrompt(p))
                         };
         return View("Index", model);
     }
 }
コード例 #2
0
    	public ActionResult Index()
    	{
    		var cookie = Request.Cookies["ShowMetadata"];
    		var showMetadata = cookie != null && cookie.Value == "1";

    		var languges =_repository.GetAvailableLanguages();

    		var prompts =
    			_repository.GetPrompts(CultureInfo.CurrentUICulture).Select(p => new TypePrompt(p)).OrderBy(p => p.TypeName).
    				ToList();
			if (!showMetadata)
				prompts = prompts.Where(p => p.TextName == null || !p.TextName.Contains("_")).ToList();

    		var model = new IndexModel
    		            	{
    		            		Prompts = prompts,
    		            		Cultures = languges,
								ShowMetadata = showMetadata
    		            	};
            return View(model);
        }
コード例 #3
0
        public ActionResult Index(FilterModel filter)
        {
            var cookie = Request.Cookies["ShowMetadata"];
            var showMetadata = cookie != null && cookie.Value == "1";
            var languages = _repository.GetAvailableLanguages();

            if (Request.HttpMethod == "POST" && filter != null)
            {
                TableFilter = filter.TableFilter;
                OnlyNotTranslated = filter.OnlyNotTranslated;
            }

            var sf = new SearchFilter();
            if (TableFilter != null)
                sf.Path = TableFilter;
            if (OnlyNotTranslated)
                sf.OnlyNotTranslated = true;

            var prompts =
                _repository.GetPrompts(CultureInfo.CurrentUICulture, DefaultUICulture.Value, sf).Select(
                    p => new Models.LocalizeTypes.TypePrompt(p)).OrderBy(p => p.TypeName).
                    ToList();
            if (!showMetadata)
                prompts = prompts.Where(p => p.TextName == null || !p.TextName.Contains("_")).ToList();


            var model = new IndexModel
                            {
                                Prompts = prompts,
                                Cultures = languages,
                                ShowMetadata = showMetadata,
                                OnlyNotTranslated = OnlyNotTranslated,
                                TableFilter = TableFilter
                            };

            return View(model);
        }