Skip to Content
avatar image
Former Member

Change dateformat and keep english language?

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

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Mar 02, 2013 at 11:20 AM

    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 };
    }
    }
    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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.

  • avatar image
    Former Member
    Jun 18, 2013 at 12:22 PM

    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.

    ...

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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! 😊