List of usage examples for java.util Locale FRANCE
Locale FRANCE
To view the source code for java.util Locale FRANCE.
Click Source Link
From source file:com.erudika.para.i18n.CurrencyUtils.java
private CurrencyUtils() { Locale[] locales = Locale.getAvailableLocales(); try {/*from www .j a va 2 s. co m*/ for (Locale l : locales) { if (!StringUtils.isBlank(l.getCountry())) { COUNTRY_TO_LOCALE_MAP.put(l.getCountry(), l); Currency c = Currency.getInstance(l); if (c != null) { CURRENCY_TO_LOCALE_MAP.put(c.getCurrencyCode(), l); CURRENCIES_MAP.put(c.getCurrencyCode(), getCurrencyName(c.getCurrencyCode(), Locale.US).concat(" ").concat(c.getSymbol(l))); } } } // overwrite main locales CURRENCY_TO_LOCALE_MAP.put("USD", Locale.US); CURRENCY_TO_LOCALE_MAP.put("EUR", Locale.FRANCE); } catch (Exception e) { logger.error(null, e); } }
From source file:mesclasses.util.NodeUtil.java
public static int getWeekNumber(LocalDate date) { WeekFields wf = WeekFields.of(Locale.FRANCE); return date.get(wf.weekOfWeekBasedYear()); }
From source file:fr.bde_eseo.eseomega.events.tickets.model.ShuttleItem.java
public String getFrenchDate(String datetime) { Date d = getParsedDate(datetime); SimpleDateFormat sdf = new SimpleDateFormat("E dd MMM '' HH'h'mm", Locale.FRANCE); return sdf.format(d); }
From source file:com.snv.bank.account.AccountControllerTest.java
@Before public void setup() { this.mockMvc = MockMvcBuilders.standaloneSetup(this.accountController).build(); this.account = new Account(); this.account.setId(1234L); this.account.setBankAddress("bank address"); this.account.setBankDeskNumber(1234L); this.account.setBankNumber(5678L); this.account.setAccountNumber(12345678L); this.account.setBankName("Test"); this.account.setBankWebSite("http://www.exemple.com"); this.account.setCurrency(Currency.getInstance(Locale.FRANCE)); User user = new User(); user.setFirstName("toto"); user.setLastName("tata"); user.setEmail("toto.tata@lol.com"); user.setProfile(Profile.ADMIN);// w w w .ja va2s. com user.setLogin("test"); user.setPassword("pass"); this.account.setUsers(Arrays.asList(user)); }
From source file:xml.sk.Parser.java
/** * Parses SectorSk.xml.//from ww w .j av a 2 s. com * * @param manager sector manager to store data * @throws javax.xml.parsers.ParserConfigurationException * @throws org.xml.sax.SAXException * @throws java.io.IOException */ public void parseSectorSk(SectorManagerImpl manager) throws ParserConfigurationException, SAXException, IOException, ParseException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse("src/main/java/xml/sk/SectorSk.xml"); NodeList sectorList = doc.getElementsByTagName("PRAC_mzdyNace"); for (int i = 0; i < sectorList.getLength(); i++) { Element sectorNode = (Element) sectorList.item(i); String name = sectorNode.getElementsByTagName("UKAZ2").item(0).getTextContent(); String[] splited = name.split(" ", 2); NodeList years = sectorNode.getChildNodes(); for (int j = 0; j < years.getLength(); j++) { if (years.item(j).getNodeType() == Node.TEXT_NODE) { continue; } Element yearNode = (Element) years.item(j); if ("UKAZ2".equals(yearNode.getNodeName())) continue; String year = yearNode.getNodeName().substring(1); if (".".equals(yearNode.getTextContent())) { continue; } String salaryStr = yearNode.getTextContent().replaceAll(" ", ""); NumberFormat format = NumberFormat.getInstance(Locale.FRANCE); Number number = format.parse(salaryStr); double salaryDouble = number.doubleValue(); Sector sector = new Sector(); sector.setCode(splited[0]); sector.setName(splited[1]); sector.setCountry("sk"); sector.setYear(year); sector.setAverageSalary(salaryDouble); manager.createSector(sector); } } }
From source file:org.ow2.proactive_grid_cloud_portal.rm.RMRestTest.java
@Test public void testStatsHistory_Locale_Fr() throws Exception { Locale.setDefault(Locale.FRANCE); JSONObject jsonObject = callGetStatHistory(); assertEquals(EXPECTED_RRD_VALUE, (Double) ((JSONArray) jsonObject.get("AverageActivity")).get(0), 0.001); }
From source file:com.fowlcorp.homebank4android.gui.AccountRecyclerAdapter.java
@Override public void onBindViewHolder(final OperationViewHolder holder, final int position) { final Operation operation = listOperation.get(position); final Calendar myDate = Calendar.getInstance(); myDate.clear();/*w w w . j av a 2 s .c o m*/ myDate.setTime(operation.getDate().getTime()); final SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy", Locale.FRANCE); holder.getRootLayout().setOnClickListener(new OnClickListener() { @SuppressWarnings("unchecked") @Override public void onClick(View v) { Intent intent = new Intent(activity.getApplicationContext(), DetailedCardActivity.class); Bundle bdl = new Bundle(); try { bdl.putString("Date", df.format(myDate.getTime())); } catch (Exception e) { } try { bdl.putString("Category", (operation.getCategory().getParent() == null ? "" : operation.getCategory().getParent().getName() + ": ") + operation.getCategory().getName()); } catch (Exception e) { } try { bdl.putString("Payee", operation.getPayee().getName()); } catch (Exception e) { } try { bdl.putString("Wording", operation.getWording()); } catch (Exception e) { } try { bdl.putString("Amount", String.valueOf(Round.roundAmount(operation.getAmount()))); } catch (Exception e) { } try { bdl.putInt("Type", operation.getPayMode()); } catch (Exception e) { } // try { // intent.putExtra("Info", operation.getInfo()); // } catch (Exception e) { // } try { bdl.putBoolean("Reconciled", operation.isReconciled()); } catch (Exception e) { } try { bdl.putBoolean("Remind", operation.isRemind()); } catch (Exception e) { } try { Log.d("Debug", String.valueOf(operation.isSplit())); bdl.putBoolean("Split", operation.isSplit()); } catch (Exception e) { } try { bdl.putSerializable("Couple", operation.getSplits()); } catch (Exception e) { e.printStackTrace(); } intent.putExtras(bdl); // Pair datePair = Pair.create(holder.getDate(), "date"); // Pair categoryPair = Pair.create(holder.getCategory(), "category"); // Pair wordingPair = Pair.create(holder.getWording(), "wording"); // Pair payeePair = Pair.create(holder.getPayee(), "payee"); // Pair amountPair = Pair.create(holder.getAmount(), "amount"); Pair<View, String> cardPair = Pair.create((View) holder.getCard(), "card"); // Pair iconPair = Pair.create(holder.getMode(), "icon"); ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, cardPair); ActivityCompat.startActivity(activity, intent, options.toBundle()); //activity.startActivity(intent, ActivityOptions.makeSceneTransitionAnimation(activity).toBundle()); //activity.startActivity(intent); } }); try { holder.getDate().setText(activity.getString(R.string.Date) + " : " + df.format(myDate.getTime())); } catch (Exception e) { } try { holder.getPayee().setText(activity.getString(R.string.Payee) + " : " + operation.getPayee().getName()); } catch (Exception e) { } try { holder.getWording().setText(activity.getString(R.string.Wording) + " : " + operation.getWording()); } catch (Exception e) { } if (!operation.isSplit()) { holder.getSplitLinear().removeAllViews(); holder.getUnSplitLinear().setVisibility(LinearLayout.VISIBLE); try { holder.getCategory() .setText(activity.getString(R.string.Wording) + " : " + (operation.getCategory().getParent() == null ? "" : operation.getCategory().getParent().getName() + ": ") + operation.getCategory().getName()); } catch (Exception e) { } } else { holder.getUnSplitLinear().setVisibility(LinearLayout.GONE); LinearLayout splitLayout = holder.getSplitLinear(); splitLayout.removeAllViews(); LayoutInflater inflater = activity.getLayoutInflater(); for (Triplet subOp : operation.getSplits()) { View view = inflater.inflate(R.layout.split_layout, null); TextView category = (TextView) view.findViewById(R.id.splitLayout_category); TextView memo = (TextView) view.findViewById(R.id.splitLayout_memo); TextView amount = (TextView) view.findViewById(R.id.splitLayout_amount); //System.out.println(activity.getString(R.string.cardLayout_category) + " " + (subOp.getCategory().getParent() == null ? "" :subOp.getCategory().getParent().getName() + ": ") + subOp.getCategory().getName()); category.setText(activity.getString(R.string.Category) + " : " + (subOp.getCategory().getParent() == null ? "" : subOp.getCategory().getParent().getName() + ": ") + subOp.getCategory().getName()); amount.setText(colorText(activity.getString(R.string.Amount) + " : ", "" + Round.roundAmount(subOp.getAmount()))); memo.setText(activity.getString(R.string.Category) + " : " + operation.getWording()); splitLayout.addView(view); } } try { holder.getAmount().setText(colorText(activity.getString(R.string.Amount) + " : ", String.valueOf(Round.roundAmount(operation.getAmount())))); } catch (Exception e) { } try { holder.getBalance().setText(colorText(activity.getString(R.string.Balance) + " : ", String.valueOf(Round.roundAmount(operation.getBalanceAccount())))); } catch (Exception e) { } if (operation.isSplit()) { holder.getOption().setImageResource(R.drawable.split); } else if (operation.isRemind()) { holder.getOption().setImageResource(R.drawable.remind); holder.getCard().setCardBackgroundColor(Color.parseColor("#ffebee")); } else { holder.getOption().setImageDrawable(null); } if (!operation.isReconciled() && !operation.isRemind()) { holder.getCard().setCardBackgroundColor(Color.parseColor("#fff3e0")); } else if (operation.isReconciled()) { holder.getCard().setCardBackgroundColor(Color.parseColor("#ffffff")); } try { switch (operation.getPayMode()) { case PayMode.CREDIT_CARD: holder.getMode().setImageResource(R.drawable.mastercard); break; case PayMode.DEBIT_CARD: holder.getMode().setImageResource(R.drawable.card); break; case PayMode.CASH: holder.getMode().setImageResource(R.drawable.cash); break; case PayMode.TRANSFERT: holder.getMode().setImageResource(R.drawable.transfert); break; case PayMode.ELECTRONIC_PAYMENT: holder.getMode().setImageResource(R.drawable.nfc); break; case PayMode.CHEQUE: holder.getMode().setImageResource(R.drawable.cheque); break; default: holder.getMode().setImageDrawable(null); break; } } catch (Exception e) { } }
From source file:fr.bde_eseo.eseomega.events.tickets.model.EventTicketItem.java
public Date getParsedDate() { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.FRANCE); Date date = null;/*from www .j a va 2 s .c o m*/ try { date = format.parse(datetime); } catch (ParseException e) { e.printStackTrace(); } return date; }
From source file:com.zion.htf.receiver.AlarmReceiver.java
@Override public void onReceive(Context context, Intent intent) { // Get preferences Resources res = context.getResources(); SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context); int setId, alarmId; try {// w w w .j a v a 2s . com if (0 == (setId = intent.getIntExtra("set_id", 0))) throw new MissingArgumentException("set_id", "int"); if (0 == (alarmId = intent.getIntExtra("alarm_id", 0))) throw new MissingArgumentException("alarm_id", "int"); } catch (MissingArgumentException e) { throw new RuntimeException(e.getMessage()); } // Fetch info about the set try { // VIBRATE will be added if user did NOT disable notification vibration // SOUND won't as it is set even if it is to the default value int flags = Notification.DEFAULT_LIGHTS; MusicSet set = MusicSet.getById(setId); Artist artist = set.getArtist(); SimpleDateFormat dateFormat; if ("fr".equals(Locale.getDefault().getLanguage())) { dateFormat = new SimpleDateFormat("HH:mm", Locale.FRANCE); } else { dateFormat = new SimpleDateFormat("h:mm aa", Locale.ENGLISH); } // Creates an explicit intent for an Activity in your app Intent resultIntent = new Intent(context, ArtistDetailsActivity.class); resultIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);// Do not start a new activity but reuse the existing one (if any) resultIntent.putExtra(ArtistDetailsActivity.EXTRA_SET_ID, setId); // Manipulate the TaskStack in order to get a good back button behaviour. See http://developer.android.com/guide/topics/ui/notifiers/notifications.html TaskStackBuilder stackBuilder = TaskStackBuilder.create(context); stackBuilder.addParentStack(ArtistDetailsActivity.class); stackBuilder.addNextIntent(resultIntent); PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT); // Extract a bitmap from a file to use a large icon Bitmap largeIconBitmap = BitmapFactory.decodeResource(context.getResources(), artist.getPictureResourceId()); // Builds the notification NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context) .setPriority(NotificationCompat.PRIORITY_MAX).setSmallIcon(R.drawable.ic_stat_notify_app_icon) .setLargeIcon(largeIconBitmap).setAutoCancel(true).setContentIntent(resultPendingIntent) .setContentTitle(artist.getName()) .setContentText(String.format(context.getString(R.string.alarm_notification), artist.getName(), set.getStage(), dateFormat.format(set.getBeginDate()))); // Vibrate settings Boolean defaultVibrate = true; if (!pref.contains(res.getString(R.string.pref_key_notifications_alarms_vibrate))) { // Get the system default for the vibrate setting AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); if (null != audioManager) { switch (audioManager.getRingerMode()) { case AudioManager.RINGER_MODE_SILENT: defaultVibrate = false; break; case AudioManager.RINGER_MODE_NORMAL: case AudioManager.RINGER_MODE_VIBRATE: default: defaultVibrate = true; } } } Boolean vibrate = pref.getBoolean(res.getString(R.string.pref_key_notifications_alarms_vibrate), defaultVibrate); // Ringtone settings String ringtone = pref.getString(res.getString(R.string.pref_key_notifications_alarms_ringtone), Settings.System.DEFAULT_NOTIFICATION_URI.toString()); // Apply notification settings if (!vibrate) { notificationBuilder.setVibrate(new long[] { 0l }); } else { flags |= Notification.DEFAULT_VIBRATE; } notificationBuilder.setSound(Uri.parse(ringtone)); // Get the stage GPS coordinates try { Stage stage = Stage.getByName(set.getStage()); // Add the expandable notification buttons PendingIntent directionsButtonPendingIntent = PendingIntent .getActivity(context, 1, new Intent(Intent.ACTION_VIEW, Uri.parse(String.format(Locale.ENGLISH, "http://maps.google.com/maps?f=d&daddr=%f,%f", stage.getLatitude(), stage.getLongitude()))), Intent.FLAG_ACTIVITY_NEW_TASK); notificationBuilder.addAction(R.drawable.ic_menu_directions, context.getString(R.string.action_directions), directionsButtonPendingIntent); } catch (InconsistentDatabaseException e) { // Although this is a serious error, its impact on functionality is minimal. // Report this through piwik if (BuildConfig.DEBUG) e.printStackTrace(); } // Finalize the notification notificationBuilder.setDefaults(flags); Notification notification = notificationBuilder.build(); NotificationManager notificationManager = (NotificationManager) context .getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify(set.getStage(), 0, notification); SavedAlarm.delete(alarmId); } catch (SetNotFoundException e) { throw new RuntimeException(e.getMessage()); // TODO: Notify that an alarm was planned but some error prevented to display it properly. Open AlarmManagerActivity on click // Report this through piwik } }
From source file:org.silverpeas.core.util.AbstractUnitTest.java
@SuppressWarnings("unchecked") @Before/*from w ww . ja v a2 s . c o m*/ public void setup() throws Exception { currentLocale = Locale.getDefault(); Locale.setDefault(Locale.FRANCE); reflectionRule.setField(DisplayI18NHelper.class, Locale.getDefault().getLanguage(), "defaultLanguage"); bundleCache = (Map) FieldUtils.readStaticField(ResourceLocator.class, "bundles", true); LocalizationBundle unitsBundle = mock(LocalizationBundle.class); when(unitsBundle.handleGetObject(anyString())).thenAnswer(invocation -> { String key = (String) invocation.getArguments()[0]; return bundle.get(key); }); bundleCache.put("org.silverpeas.util.multilang.util", unitsBundle); bundleCache.put("org.silverpeas.util.multilang.util_" + Locale.getDefault().getLanguage(), unitsBundle); }