List of usage examples for java.util Locale CHINA
Locale CHINA
To view the source code for java.util Locale CHINA.
Click Source Link
From source file:com.wiiyaya.framework.provider.utils.SpringContextUtils.java
public static String getMessage(String code, Object... args) throws BeansException { return applicationContext.getMessage(code, args, Locale.CHINA); }
From source file:com.arvato.thoroughly.util.CommonUtils.java
/** * Get all dates within three months//from w ww . java2s .c om * * @param startDate * @param nowDate * * @return Sample Data: * <p> * key:value-->start:2001-01-01 00:00:00 <br> * or <br> * end:2001-01-01 23:59:59 <br> */ public static List<Map<String, Date>> findDates(Date startDate, Date nowDate) { List<Map<String, Date>> lDate = new ArrayList<Map<String, Date>>(); SimpleDateFormat ymd = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA); SimpleDateFormat ymdmhs = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA); Calendar calendar = Calendar.getInstance(); if (nowDate == null && startDate == null) { nowDate = calendar.getTime(); calendar.add(Calendar.MONTH, -3); startDate = calendar.getTime(); } else if (nowDate != null && startDate == null) { calendar.add(Calendar.MONTH, -3); startDate = calendar.getTime(); } else if (nowDate == null && startDate != null) { nowDate = calendar.getTime(); } try { Map<String, Date> beginItem = new HashMap<String, Date>(); beginItem.put("start", ymdmhs.parse(ymd.format(startDate) + " 00:00:00")); beginItem.put("end", ymdmhs.parse(ymd.format(startDate) + " 23:59:59")); lDate.add(beginItem); Calendar calBegin = Calendar.getInstance(); calBegin.setTime(startDate); Calendar calEnd = Calendar.getInstance(); calEnd.setTime(startDate); while (ymd.parse(ymd.format(nowDate)).after(calBegin.getTime())) { calBegin.add(Calendar.DAY_OF_MONTH, 1); Map<String, Date> dateItem = new HashMap<String, Date>(); dateItem.put("start", ymdmhs.parse(ymd.format(calBegin.getTime()) + " 00:00:00")); dateItem.put("end", ymdmhs.parse(ymd.format(calBegin.getTime()) + " 23:59:59")); lDate.add(dateItem); } } catch (ParseException e) { LOGGER.error(e.getMessage()); } return lDate; }
From source file:org.openhie.openempi.util.DateConverterTest.java
public void testInternationalization() throws Exception { List<Locale> locales = new ArrayList<Locale>() { private static final long serialVersionUID = 1L; {//from w w w .j a v a2 s .com add(Locale.US); add(Locale.GERMANY); add(Locale.FRANCE); add(Locale.CHINA); add(Locale.ITALY); } }; for (Locale locale : locales) { LocaleContextHolder.setLocale(locale); testConvertStringToDate(); testConvertDateToString(); testConvertStringToTimestamp(); testConvertTimestampToString(); } }
From source file:org.openmrs.contrib.metadatarepository.util.DateConverterTest.java
public void testInternationalization() throws Exception { final List<Locale> locales = new ArrayList<Locale>() { private static final long serialVersionUID = 1L; {//from w w w.j a v a2 s.c o m add(Locale.US); add(Locale.GERMANY); add(Locale.FRANCE); add(Locale.CHINA); add(Locale.ITALY); } }; for (final Locale locale : locales) { LocaleContextHolder.setLocale(locale); testConvertStringToDate(); testConvertDateToString(); testConvertStringToTimestamp(); testConvertTimestampToString(); } }
From source file:com.xw.project.gracefulmovies.view.activity.AboutActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); transparentStatusBar();//ww w. j a v a2 s . co m setContentView(R.layout.activity_about); ButterKnife.bind(this); initializeToolbar(); Glide.with(this).load(R.drawable.pic_movie_projector).into(mHeaderImg); try { PackageManager manager = getPackageManager(); PackageInfo info = manager.getPackageInfo(getPackageName(), 0); String s = String.format(Locale.CHINA, "%sBuild %d", info.versionName, info.versionCode); mVersionNameText.setText(s); } catch (Exception e) { e.printStackTrace(); mVersionNameText.setText(""); } if (Colorful.getThemeDelegate().isNight()) { Drawable drawable = mGitHubImg.getDrawable(); if (drawable != null) { DrawableCompat.setTint(drawable, Color.WHITE); mGitHubImg.setImageDrawable(drawable); } } mLicenseText.setText(Html.fromHtml(getString(R.string.license))); }
From source file:com.bzu.yhd.pocketcampus.main.AboutActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_about); mUnbinder = ButterKnife.bind(this); initializeToolbar();/*from ww w . j a v a2 s . c o m*/ BaseApplication.getInstance().addActivity(this); Glide.with(this).load(R.mipmap.flowbloom).into(mHeaderImg); try { PackageManager manager = getPackageManager(); PackageInfo info = manager.getPackageInfo(getPackageName(), 0); String s = String.format(Locale.CHINA, "%sBuild %d", info.versionName, info.versionCode); mVersionNameText.setText(s); } catch (Exception e) { e.printStackTrace(); mVersionNameText.setText(""); } if (Colorful.getThemeDelegate().isNight()) { Drawable drawable = mGitHubImg.getDrawable(); if (drawable != null) { DrawableCompat.setTint(drawable, Color.WHITE); mGitHubImg.setImageDrawable(drawable); } } mLicenseText.setText(Html.fromHtml(getString(R.string.license))); }
From source file:org.pdfsam.support.LocaleKeyValueItemTest.java
@Test public void equalsAndHashCodes() { LocaleKeyValueItem eq1 = new LocaleKeyValueItem(Locale.CANADA); LocaleKeyValueItem eq2 = new LocaleKeyValueItem(Locale.CANADA); LocaleKeyValueItem eq3 = new LocaleKeyValueItem(Locale.CANADA); LocaleKeyValueItem diff = new LocaleKeyValueItem(Locale.CHINA); TestUtils.testEqualsAndHashCodes(eq1, eq2, eq3, diff); }
From source file:zz.filecollector.FileInfo.java
public void setCreateDate(Date createDate) { this.createDate = createDate; this.calendar = Calendar.getInstance(TimeZone.getTimeZone("Asia/Shanghai"), Locale.CHINA); this.calendar.setTime(createDate); }
From source file:org.web4thejob.orm.ListSerializationTest.java
@Test public void localesListTest() throws IOException { final Marshaller marshaller = ContextUtil.getBean(Marshaller.class); Assert.assertNotNull(marshaller);//from w ww . j a v a2s . c om List<Locale> locales = new ArrayList<Locale>(); locales.add(Locale.CANADA); locales.add(Locale.CHINA); locales.add(Locale.ENGLISH); final ByteArrayOutputStream out = new ByteArrayOutputStream(); final Result result = new StreamResult(out); marshaller.marshal(locales, result); System.out.println(out.toString("UTF-8")); }
From source file:net.noday.cat.web.admin.DwzManager.java
@RequestMapping(method = RequestMethod.POST) public Model gen(@RequestParam("url") String url, @RequestParam("alias") String alias, Model m) { try {//from ww w .j a va 2s.c o m String urlstr = "http://dwz.cn/create.php"; URL requrl = new URL(urlstr); URLConnection conn = requrl.openConnection(); conn.setDoOutput(true); OutputStreamWriter out = new OutputStreamWriter(conn.getOutputStream()); String param = String.format(Locale.CHINA, "url=%s&alias=%s", url, alias); out.write(param); out.flush(); out.close(); BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); String line = reader.readLine(); //{"longurl":"http:\/\/www.hao123.com\/","status":0,"tinyurl":"http:\/\/dwz.cn\/1RIKG"} ObjectMapper mapper = new ObjectMapper(); Dwz dwz = mapper.readValue(line, Dwz.class); if (dwz.getStatus() == 0) { responseData(m, dwz.getTinyurl()); } else { responseMsg(m, false, dwz.getErr_msg()); } } catch (MalformedURLException e) { log.error(e.getMessage(), e); responseMsg(m, false, e.getMessage()); } catch (IOException e) { log.error(e.getMessage(), e); responseMsg(m, false, e.getMessage()); } return m; }