Class Locale


  • @Component
    public class Locale
    extends java.lang.Object
    Representation of the current used Locale for translation. This class is thread safe.
    Author:
    Andi Hotz, (c) Sahits GmbH, 2011 Created on Jan 9, 2011
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private GamePropertyUtility gamePropertyUtility
      Game properties utility used for loading the locale
      private java.util.Locale l
      Reference the real local that is used by the Java API
      private java.util.Locale[] supportedLocales
      List of supported locals
    • Constructor Summary

      Constructors 
      Constructor Description
      Locale()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Locale getCurrentLocal()
      Retrieve the currently set locale
      java.util.Locale[] getSupportedLocales()
      Retrieve an array of all supported locales
      private void initLocale()
      Loading and setting the game locale
      void setLocale​(java.util.Locale locale)
      Set a new locale.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • gamePropertyUtility

        @Autowired
        private GamePropertyUtility gamePropertyUtility
        Game properties utility used for loading the locale
      • l

        private java.util.Locale l
        Reference the real local that is used by the Java API
      • supportedLocales

        private final java.util.Locale[] supportedLocales
        List of supported locals
    • Constructor Detail

      • Locale

        public Locale()
    • Method Detail

      • initLocale

        @PostConstruct
        private void initLocale()
        Loading and setting the game locale
      • getCurrentLocal

        public java.util.Locale getCurrentLocal()
        Retrieve the currently set locale
        Returns:
        java.util.Locale
      • getSupportedLocales

        public java.util.Locale[] getSupportedLocales()
        Retrieve an array of all supported locales
        Returns:
        array of supported java.util.Locale
      • setLocale

        public void setLocale​(java.util.Locale locale)
        Set a new locale. The locale must be one of the supported ones.
        Parameters:
        locale - java.util.Locale