Jahia DX > Handler unsupported...

0 (0 Good)
0 (0 Bad)

Handler unsupported language

by  tripm »  2013/08/21 08:00

Hi all,
I had a site which was using multiple language. And now, I want to add new language (In my case is: "fr_MA") But I didn't see this language in section "Manage Languages".
How can I extend the list of available languages?
Best regards,
  • Handler unsupported language
    2013/08/21 08:00

    tripm <div> Hi all,</div> <div> I had a site which was using multiple language. And now, I want to add new language (In my case is: &quot;fr_MA&quot;) But I didn&#39;t see this language in section &quot;Manage Languages&quot;.</div> <div> How can I extend the list of available languages?</div> <div> Best regards,</div>

  • Number of messages  1
    Registration date Aug 21, 2013
    1 (1 Good)
    0 (0 Bad)

    Re: Handler unsupported language

    by  pap@commaro.com »  2013/08/21 11:07

    Hi,

    there already was a forum discussion about that here with some further links: http://www.jahia.com/home/download/forum/jahia-user/jahia-65/adding-a-custom-locale.html

    For instance I tested to create a JAR with a class file like this:

    package org.jahia.test.services.i18n;

    import java.util.Currency;
    import java.util.Locale;
    import java.util.spi.CurrencyNameProvider;

    public class MyCustomLocales extends CurrencyNameProvider {
        final static Locale[] locales = new Locale[]{new Locale("fr", "MA")};

        @Override
        public Locale[] getAvailableLocales() {
            return locales;
        }
        @Override
        public String getSymbol(String currencyCode, Locale locale) {
            if (currencyCode == null || locale == null)
                throw new NullPointerException();
              if (currencyCode.length() != 3)
                throw new IllegalArgumentException("currency code length not 3");
              for (int i = 0; i < 3; i++)
                if (!Character.isUpperCase(currencyCode.charAt(i)))
                  throw new IllegalArgumentException("bad currency code");
              if (!locale.equals(locales[0]))
                throw new IllegalArgumentException("unsupported locale");
              if (currencyCode.equals("MAD"))
                return "MAD";
              else
                return null;
        }
    }

    and then I added a META-INF\services\java.util.spi.CurrencyNameProvider file to the JAR listing my implementation in a line of that file and deployed the created JAR to <JDK-HOME>\jre\lib\ext . After restarting the Jahia server, the French (Morocco) got listed as available language.

    Regards,
    Benjamin

    Benjamin Papez (pap@commaro.com)

    Number of messages  220
    Registration date
    Contact
    Share
    Feedback

    Get in touch

    Whether you are a current user or if you are just evaluating Jahia, we are here to help.

    Contact us

    Share this page