messageformat

TimeZone and MessageFormat with date parameters

拟墨画扇 提交于 2021-01-27 04:46:14
问题 MessageFormat class is cool because we can insert parameters and do the formatting directly with it. This permits me to be able to easily override a date format directly in a message bundle properties files. For exemple: MessageFormat.format("Test inserting a date param here: {0,date,dd/MM/yyyy HH'h'mm} -> OK cool", new Date() ); But what if i need to display the date in different timezones? I know i can format all dates before injecting them in my bundle, but this is a pain to format every

TimeZone and MessageFormat with date parameters

坚强是说给别人听的谎言 提交于 2021-01-27 04:46:07
问题 MessageFormat class is cool because we can insert parameters and do the formatting directly with it. This permits me to be able to easily override a date format directly in a message bundle properties files. For exemple: MessageFormat.format("Test inserting a date param here: {0,date,dd/MM/yyyy HH'h'mm} -> OK cool", new Date() ); But what if i need to display the date in different timezones? I know i can format all dates before injecting them in my bundle, but this is a pain to format every

Nested choice clause in MessageFormat?

眉间皱痕 提交于 2020-12-05 02:26:53
问题 I'm trying to do a simple logic with java.text.MessageFormat: MessageFormat cf = new MessageFormat( "{0,choice, 1<hello|5<{1,choice,1<more than one|4<more than four}}"); Object[] array = {3, 1}; System.out.println(cf.format(array)); With words: If the first parameter is greater then 1 print "hello", if it is greater than 5 than if the second parameter is greater than 1 print "more than one" if the second parameter is greater than 4 print "more than four". I found no one saying it is

Binary data to text/string in XQuery

﹥>﹥吖頭↗ 提交于 2019-12-08 13:16:46
问题 When xml converted through MFL(Message Format Language) from xml to binary, it comes as following in logs of Oracle Service Bus. <soap-env:Body xmlns:soap-env = "http://schemas.xmlsoap.org/soap/envelope/"> <ctx:binary-content ref="cid:69b63814:144d49f1544:-6cba" xmlns:ctx="http://www.bea.com/wli/sb/context"/> </soap-env:Body> Can any body tell me how to print this log in text/string in Xquery or OSB. Is there any function or method of xquery i can use ? 回答1: Used java Call out to convert this

Java's MessageFormat Not Localizing Portuguese Months in Dates in Lowercase

落爺英雄遲暮 提交于 2019-12-07 22:48:16
问题 The month names start with an uppercase letter instead of lowercase, as they should. Some sample code I ran on my local machine: Locale portugal = new Locale("pt"); Locale brazil = new Locale("pt", "BR"); Locale france = new Locale("fr", "FR"); Object[] params = new Object[] { new Date() }; String pattern = "Today is {0,date,long}!"; MessageFormat ptFormat = new MessageFormat(pattern, portugal); MessageFormat brFormat = new MessageFormat(pattern, brazil); MessageFormat frFormat = new

Java's MessageFormat Not Localizing Portuguese Months in Dates in Lowercase

▼魔方 西西 提交于 2019-12-06 08:20:26
The month names start with an uppercase letter instead of lowercase, as they should . Some sample code I ran on my local machine: Locale portugal = new Locale("pt"); Locale brazil = new Locale("pt", "BR"); Locale france = new Locale("fr", "FR"); Object[] params = new Object[] { new Date() }; String pattern = "Today is {0,date,long}!"; MessageFormat ptFormat = new MessageFormat(pattern, portugal); MessageFormat brFormat = new MessageFormat(pattern, brazil); MessageFormat frFormat = new MessageFormat(pattern, france); StringBuffer ptResult = ptFormat.format(params, new StringBuffer(), new

Should I use java.text.MessageFormat for localised messages without placeholders?

为君一笑 提交于 2019-12-05 16:32:49
问题 We are localising the user-interface text for a web application that runs on Java 5, and have a dilemma about how we output messages that are defined in properties files - the kind used by java.util.Properties. Some messages include a placeholder that will be filled using java.text.MessageFormat. For example: search.summary = Your search for {0} found {1} items. MessageFormat is annoying, because a single quote is a special character, despite being common in English text. You have to type two

Java internationalization (i18n) with proper plurals

旧时模样 提交于 2019-12-04 07:41:36
问题 I was going to use Java's standard i18n system with the ChoiceFormat class for plurals, but then realized that it doesn't handle the complex plural rules of some languages (e.g. Polish). If it only handles languages that resemble English, then it seems a little pointless. What options are there to achieve correct plural forms? What are the pros and cons of using them? 回答1: Well, you already tagged the question correctly, so I assume you know thing or two about ICU. With ICU you have two

difference between MessageFormat.format and String.format in jdk1.5?

我只是一个虾纸丫 提交于 2019-12-03 03:25:34
问题 What is the difference between MessageFormat.format and String.format in JDK 1.5? 回答1: Put simply, the main difference is in format string: MessageFormat.format() format string accepts argument positions (eg. {0} , {1} ). Example: "This is year {0}!" The developer doesn't have to worry about argument types, because they are, most often, recognized and formated according to current Locale . String.format() format string accepts argument type specifiers (eg. %d for numbers, %s for strings).

difference between MessageFormat.format and String.format in jdk1.5?

可紊 提交于 2019-12-02 16:56:13
What is the difference between MessageFormat.format and String.format in JDK 1.5? Put simply, the main difference is in format string: MessageFormat.format() format string accepts argument positions (eg. {0} , {1} ). Example: "This is year {0}!" The developer doesn't have to worry about argument types, because they are, most often, recognized and formated according to current Locale . String.format() format string accepts argument type specifiers (eg. %d for numbers, %s for strings). Example: "This is year %d!" String.format() generally gives you much more control over how the argument is