cancel
Showing results for 
Search instead for 
Did you mean: 

Change dateformat and keep english language?

0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

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 };
}
}

0 Kudos

I have problems to add the custom language jar to jre/lib/ext at the portal server.

It's being deleted when the portal server is being restarted.

Anyone knows why the SAP JVM behave like this at the portal server?

BR

Tobias

0 Kudos

Turns out that the start SAP routine always copy the server's latest SAPJVM to portal's SAPJVM folder.

So I just added my jar fil to this server SAPJVM folder and then the portal loaded the jar file as expected.

0 Kudos

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.

Answers (1)

Answers (1)

0 Kudos

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.

...

0 Kudos

I openend an OSS case and SAP eventually found a coding error within their code.

So there is a patch available to fix this.

See SAP note 2018848

Have fun, with the new language, dateformat and numberformat combinations!