close

Filter

Multi-Site Manual / Version 2107

Table Of Contents

3.2.2 Adding Java Locales

CoreMedia Multi-Site relies on the representations of locales as provided by Java. For best support for your locale you should check Locale.getAvailableLocales() to contain your locale.

Providing customized locales is best sketched with Locale.Builder. Use it to create your locale and use the resulting Locale.toLanguageTag() for your Multi-Site configuration.

        
        new Locale.Builder()
          // Base on existing locale.
          .setLocale(Locale.US)
          // ! Not part of Display Name !
          .setExtension(Locale.PRIVATE_USE_EXTENSION, "myExt")
          // Registered by IANA; Qaaa - Qabx for private use
          .setScript("Latf")
          // Custom key-value pairs.
          .setUnicodeLocaleKeyword("lK", "local-value")
          // Registered by IANA
          .setVariant("1994")
          .build()
          .toLanguageTag()

      

Example 3.1. Creating Locale with Locale.Builder


Warning

Beware of Locale.toString()

Especially in context of CoreMedia Multi-Site you should not rely on the representation of Locale.toString(), which, at first glance seems to be a language tag, just using underscores such as en_US. In contrast to IETF BCP 47 language tags this representation has no strict specification and as such cannot reliably be parsed from String representation back to a valid Locale.

Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.