code: private void installLocaleProvider() {
          LocaleProvider.setProvider(new LocaleProvider() {
              public Locale get() {
                  Locale locale=null;
                  StaplerRequest req = Stapler.getCurrentRequest();
                  if(req!=null)
                      locale = req.getLocale();
                  if(locale==null)
                      locale = Locale.getDefault();
                  return locale;
              }
          });
      }
docs: Install {@link LocaleProvider} that uses the current request to determine the language.