1 package org.itracker.web.actions.admin.language; 2 3 import org.apache.struts.action.ActionForm; 4 import org.apache.struts.action.ActionForward; 5 import org.apache.struts.action.ActionMapping; 6 import org.itracker.core.resources.ITrackerResources; 7 import org.itracker.services.ConfigurationService; 8 import org.itracker.web.actions.base.ItrackerBaseAction; 9 import org.itracker.web.util.ServletContextUtils; 10 11 import javax.servlet.http.HttpServletRequest; 12 import javax.servlet.http.HttpServletResponse; 13 import java.util.List; 14 import java.util.Map; 15 16 public class ListLanguagesAction extends ItrackerBaseAction { 17 18 public ActionForward execute(ActionMapping mapping, ActionForm form, 19 HttpServletRequest request, HttpServletResponse response) 20 throws Exception { 21 22 ConfigurationService configurationService = ServletContextUtils.getItrackerServices() 23 .getConfigurationService(); 24 25 Map<String, List<String>> languages = configurationService.getAvailableLanguages(); 26 27 28 String baseLocaleName = ITrackerResources.getString("itracker.web.attr.baselocale"); 29 request.setAttribute("languages", languages); 30 request.setAttribute("languageKeys", languages.keySet().toArray()); 31 request.setAttribute("baseLocaleName", baseLocaleName); 32 request.setAttribute("baseLocale", ITrackerResources.BASE_LOCALE); 33 34 return mapping.findForward("listlanguages"); 35 36 } 37 }