on 03-01-2013 2:32 PM
Hi,
I have a language and dateformat(&numberformat) issue.
The portal 7.31 that we run should display all texts in english, but the dateformats and numbers should be decided by the users via their user account.
Initially, we setup the portal to only allow theses locates, en, en_US, en_MX, en_SE, en_ and so on.
Thought the country code would affect the dateformats and numbers, but I seem to be wrong at it.
Is it the language that decides the dateformat? I thought it was the country.
Is there some configuration you can do in the portal to decide the date&number format for a locale for example en_SE?
Note: it's not an option to make this via code in each of our web dynpro for java application.
BR
Tobias
I found out that you can extend the JVM by adding Locale's dateformats etc to the JVM, by it's jre/lib/ext folder.
This is possible from Java 6 and I'm NW Portal 7.31, which is a Java 6.
I managed to add the dateformat to my local SAP JVM, can't wait until I can test this on the actual portal server.
By this code I can keep the english language though I changed the dateformat, I will do this for numberformat as well.
public class MyDateFormatProvider extends DateFormatProvider {
private Locale en_SE = new Locale ("en", "SE");
private Locale dateFormatForSE = new Locale("sv");
@Override
public DateFormat getDateInstance(int style, Locale locale) {
if (locale.equals(en_SE)) {
return DateFormat.getDateInstance(style, dateFormatForSE);
}
return null;
}
@Override
public DateFormat getDateTimeInstance(int dateStyle, int timeStyle,Locale locale) {
if (locale.equals(en_SE)) {
return DateFormat.getDateTimeInstance(dateStyle,timeStyle,dateFormatForSE);
}
return null;
}
@Override
public DateFormat getTimeInstance(int style, Locale locale) {
if (locale.equals(en_SE)) {
return DateFormat.getTimeInstance(style,dateFormatForSE);
}
return null;
}
@Override
public Locale[] getAvailableLocales() {
return new Locale[] { en_SE };
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The solution to extend the SAPJVM with a java extenstion worked.
Now, I got more locale combinations, regarding english language and additional countries such as SE,DK,MX and so on.
Note that the small example above is not sufficient, you need to implement several providers such as
- BreakIteratorProvider
- CollatorProvider
- DateFormatProvider
- DateFormatSymbolsProvider
- DecimalFormatSymbolsProvider
- NumberFormatProvider
Skipped
- CurrencyNameProvider
- LocaleNameProvider
- TimeZoneNameProvider
So far it works, well seen when I try to go all the way to production.
The solution above works for dateformats but not for numberformats.
The SAPJVM have the new numberformats and you can use them via your java code.
But web dynpro for java has special locale logic to the numberformatting and thereby picks the wrong numberformats.
I have not given up yet, we will see if there is a work around this numberformat matter.
...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
11 | |
11 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.