package etf.beans;

import java.io.Serializable;
import java.util.Locale;
import java.util.ResourceBundle;

import javax.faces.bean.ManagedBean; 
   // or import javax.inject.Named;
import javax.faces.bean.SessionScoped; 
   // or import javax.enterprise.context.SessionScoped;
import javax.faces.context.FacesContext;

@ManagedBean // or @Named
@SessionScoped
public class PromenaLokalizacije implements Serializable {
   public String srpski() {
      FacesContext context = FacesContext.getCurrentInstance();
      context.getViewRoot().setLocale(new Locale("rs"));
      //String cc = context.getViewRoot().getLocale().getDisplayLanguage();
      //context.getViewRoot().getLocale().get
      ResourceBundle paket = context.getApplication().getResourceBundle(context, "por");
      String poruka = paket.getString("porukaProzor");
      return null;
   }
   
   public String engleski() {
      FacesContext context = FacesContext.getCurrentInstance();
      context.getViewRoot().setLocale(Locale.ENGLISH);
      return null;
   }
}