本文整理了Java中org.kohsuke.stapler.StaplerRequest.getLocale()
方法的一些代码示例,展示了StaplerRequest.getLocale()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。StaplerRequest.getLocale()
方法的具体详情如下:
包路径:org.kohsuke.stapler.StaplerRequest
类名称:StaplerRequest
方法名:getLocale
暂无
代码示例来源:origin: jenkinsci/jenkins
public static Locale getCurrentLocale() {
Locale locale=null;
StaplerRequest req = Stapler.getCurrentRequest();
if(req!=null)
locale = req.getLocale();
if(locale==null)
locale = Locale.getDefault();
return locale;
}
代码示例来源:origin: jenkinsci/jenkins
private URL getStaticHelpUrl(Klass<?> c, String suffix) {
Locale locale = Stapler.getCurrentRequest().getLocale();
String base = "help"+suffix;
URL url;
url = c.getResource(base + '_' + locale.getLanguage() + '_' + locale.getCountry() + '_' + locale.getVariant() + ".html");
if(url!=null) return url;
url = c.getResource(base + '_' + locale.getLanguage() + '_' + locale.getCountry() + ".html");
if(url!=null) return url;
url = c.getResource(base + '_' + locale.getLanguage() + ".html");
if(url!=null) return url;
// default
return c.getResource(base + ".html");
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Returns the build time stamp in the body.
*/
public void doBuildTimestamp( StaplerRequest req, StaplerResponse rsp, @QueryParameter String format) throws IOException {
rsp.setContentType("text/plain");
rsp.setCharacterEncoding("US-ASCII");
rsp.setStatus(HttpServletResponse.SC_OK);
DateFormat df = format==null ?
DateFormat.getDateTimeInstance(DateFormat.SHORT,DateFormat.SHORT, Locale.ENGLISH) :
new SimpleDateFormat(format,req.getLocale());
rsp.getWriter().print(df.format(getTime()));
}
代码示例来源:origin: jenkinsci/jenkins
Locale locale = request.getLocale();
代码示例来源:origin: jenkinsci/jenkins
if(serveDirIndex) {
glob = baseFile.run(new BuildChildPaths(baseFile, req.getLocale()));
代码示例来源:origin: org.jenkins-ci.plugins/credentials
public ListBoxModelOptionComparator() {
StaplerRequest req = Stapler.getCurrentRequest();
if (req != null) {
locale = req.getLocale();
} else {
locale = Locale.getDefault();
}
collator = Collator.getInstance(locale);
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
public static Locale getCurrentLocale() {
Locale locale=null;
StaplerRequest req = Stapler.getCurrentRequest();
if(req!=null)
locale = req.getLocale();
if(locale==null)
locale = Locale.getDefault();
return locale;
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
public Locale get() {
Locale locale=null;
StaplerRequest req = Stapler.getCurrentRequest();
if(req!=null)
locale = req.getLocale();
if(locale==null)
locale = Locale.getDefault();
return locale;
}
});
代码示例来源:origin: org.hudsonci.plugins/run-condition
public String getDayName(final int day) {
final Calendar ref = Calendar.getInstance();
ref.set(Calendar.DAY_OF_WEEK, day);
return String.format(Stapler.getCurrentRequest().getLocale(), "%tA", ref);
}
代码示例来源:origin: org.kohsuke.stapler/stapler
public Locale get() {
Locale locale=null;
StaplerRequest req = Stapler.getCurrentRequest();
if(req!=null)
locale = req.getLocale();
if(locale==null)
locale = Locale.getDefault();
return locale;
}
});
代码示例来源:origin: stapler/stapler
public Locale get() {
Locale locale=null;
StaplerRequest req = Stapler.getCurrentRequest();
if(req!=null)
locale = req.getLocale();
if(locale==null)
locale = Locale.getDefault();
return locale;
}
});
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
public Locale get() {
Locale locale=null;
StaplerRequest req = Stapler.getCurrentRequest();
if(req!=null)
locale = req.getLocale();
if(locale==null)
locale = Locale.getDefault();
return locale;
}
});
代码示例来源:origin: hudson/hudson-2.x
public Locale get() {
Locale locale=null;
StaplerRequest req = Stapler.getCurrentRequest();
if(req!=null)
locale = req.getLocale();
if(locale==null)
locale = Locale.getDefault();
return locale;
}
});
代码示例来源:origin: org.hudsonci.stapler/stapler-core
public Locale get() {
Locale locale=null;
StaplerRequest req = Stapler.getCurrentRequest();
if(req!=null)
locale = req.getLocale();
if(locale==null)
locale = Locale.getDefault();
return locale;
}
});
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
private URL getStaticHelpUrl(Klass<?> c, String suffix) {
Locale locale = Stapler.getCurrentRequest().getLocale();
String base = "help"+suffix;
URL url;
url = c.getResource(base + '_' + locale.getLanguage() + '_' + locale.getCountry() + '_' + locale.getVariant() + ".html");
if(url!=null) return url;
url = c.getResource(base + '_' + locale.getLanguage() + '_' + locale.getCountry() + ".html");
if(url!=null) return url;
url = c.getResource(base + '_' + locale.getLanguage() + ".html");
if(url!=null) return url;
// default
return c.getResource(base + ".html");
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Returns the build time stamp in the body.
*/
public void doBuildTimestamp( StaplerRequest req, StaplerResponse rsp, @QueryParameter String format) throws IOException {
rsp.setContentType("text/plain");
rsp.setCharacterEncoding("US-ASCII");
rsp.setStatus(HttpServletResponse.SC_OK);
DateFormat df = format==null ?
DateFormat.getDateTimeInstance(DateFormat.SHORT,DateFormat.SHORT, Locale.ENGLISH) :
new SimpleDateFormat(format,req.getLocale());
rsp.getWriter().print(df.format(getTime()));
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
/**
* Returns the build time stamp in the body.
*/
public void doBuildTimestamp( StaplerRequest req, StaplerResponse rsp, @QueryParameter String format) throws IOException {
rsp.setContentType("text/plain");
rsp.setCharacterEncoding("US-ASCII");
rsp.setStatus(HttpServletResponse.SC_OK);
DateFormat df = format==null ?
DateFormat.getDateTimeInstance(DateFormat.SHORT,DateFormat.SHORT, Locale.ENGLISH) :
new SimpleDateFormat(format,req.getLocale());
rsp.getWriter().print(df.format(getTime()));
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
/**
* Returns the build time stamp in the body.
*/
public void doBuildTimestamp( StaplerRequest req, StaplerResponse rsp, @QueryParameter String format) throws IOException {
rsp.setContentType("text/plain");
rsp.setCharacterEncoding("US-ASCII");
rsp.setStatus(HttpServletResponse.SC_OK);
DateFormat df = format==null ?
DateFormat.getDateTimeInstance(DateFormat.SHORT,DateFormat.SHORT, Locale.ENGLISH) :
new SimpleDateFormat(format,req.getLocale());
rsp.getWriter().print(df.format(getTime()));
}
代码示例来源:origin: hudson/hudson-2.x
/**
* Returns the build time stamp in the body.
*/
public void doBuildTimestamp( StaplerRequest req, StaplerResponse rsp, @QueryParameter String format) throws IOException {
rsp.setContentType("text/plain");
rsp.setCharacterEncoding("US-ASCII");
rsp.setStatus(HttpServletResponse.SC_OK);
DateFormat df = format==null ?
DateFormat.getDateTimeInstance(DateFormat.SHORT,DateFormat.SHORT, Locale.ENGLISH) :
new SimpleDateFormat(format,req.getLocale());
rsp.getWriter().print(df.format(getTime()));
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
/**
* Returns the build time stamp in the body.
*/
public void doBuildTimestamp(StaplerRequest req, StaplerResponse rsp, @QueryParameter String format) throws IOException {
rsp.setContentType("text/plain");
rsp.setCharacterEncoding("US-ASCII");
rsp.setStatus(HttpServletResponse.SC_OK);
DateFormat df = format == null
? DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, Locale.ENGLISH)
: new SimpleDateFormat(format, req.getLocale());
rsp.getWriter().print(df.format(getTime()));
}
内容来源于网络,如有侵权,请联系作者删除!