Class ClientLocalizationManagerImpl

    • Constructor Detail

      • ClientLocalizationManagerImpl

        public ClientLocalizationManagerImpl​(ClientContextImpl context)
    • Method Detail

      • initNotificationListener

        public void initNotificationListener()
      • loadTranslationDatabase

        public void loadTranslationDatabase​(java.io.File location)
        This functions loads the term db from a file, which should be a serialized TranslationPackage.
      • getBaseLocale

        public java.util.Locale getBaseLocale()
        Returns:
        the "base" locale, the language in which the terms are defined.
      • getKeyHashRule

        public KeyHashRule getKeyHashRule()
        Description copied from interface: TranslationPackage
        The key hash rule dictates how term equivalency is calculated. Though this field should not be used to look up terms, it's important that derived translation packages use the same rule.
      • isDefined

        public boolean isDefined​(java.lang.String key)
        Description copied from interface: TranslationPackage
        Returns whether the key is defined in the package. A key can be defined without any particular translations.
      • isDefined

        public boolean isDefined​(java.lang.String key,
                                 java.util.Locale l)
        Description copied from interface: TranslationPackage
        Returns whether there is a translation defined for the given key in the given locale.
      • get

        public java.lang.String get​(java.util.Locale locale,
                                    java.lang.String key)
        Specified by:
        get in interface TranslationPackage
        Specified by:
        get in class ClientLocalizationManager
        key - the key to find a match for, or return value if no value found
        Returns:
        the translation of the key for the requested locale, or the key, if the translation is not available.
      • getStrict

        public java.lang.String getStrict​(java.util.Locale locale,
                                          java.lang.String key)
        Specified by:
        getStrict in interface TranslationPackage
        Specified by:
        getStrict in class ClientLocalizationManager
        Parameters:
        locale - the locale to find a value for
        key - the key to find a match for
        Returns:
        the translation, or null if the translation doesn't exist.
      • getAvailableKeys

        public java.util.Collection<java.lang.String> getAvailableKeys()
        Returns:
        all of the defined keys.
      • createDiff

        public TranslationPackageDiff createDiff()
        Returns:
        an empty, modifiable diff that respects the same rules as the translation package.
      • getAllTranslations

        public java.util.Iterator<Translation> getAllTranslations()
        Returns:
        an iterator that goes through all of the translations. Does not include defined keys that have no translations.
      • fireLocaleChanged

        protected void fireLocaleChanged()