Class TranslationUtils


  • public class TranslationUtils
    extends java.lang.Object
    Tools used for translating component properties.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String _t​(java.lang.String bundleKey, java.lang.Object... args)
      FOR BUNDLE KEYS NOT IN COMPONENTS.
      static java.lang.String _t​(javax.swing.JComponent component, java.lang.String bundleKey, java.lang.Object... args)
      FOR BUNDLE KEYS.
      static MutableTranslationPackage createComponentTranslations​(javax.swing.JComponent comp)  
      static MutableTranslationPackage getComponentTranslations​(javax.swing.JComponent comp, boolean createIfNecessary)  
      static Dataset getTranslatedDataset​(Dataset ds, int labelColumnIndex, javax.swing.JComponent component)  
      static Dataset getTranslatedDataset​(Dataset ds, int labelColumnIndex, javax.swing.JComponent component, boolean translateColumnNames)  
      protected static boolean isClientTranslationEnabled()  
      static boolean isTranslatable​(javax.swing.JComponent source)  
      static java.lang.String t​(java.lang.String term)
      NOT FOR BUNDLE KEYS, and not for components.
      static java.lang.String t​(javax.swing.JComponent component, java.lang.String term)
      NOT FOR BUNDLE KEYS.
      static java.lang.String translate​(javax.swing.JComponent component, java.lang.String term)
      This class returns the best translation available for the specified term in the provided component.
      static java.lang.String translate​(javax.swing.JComponent component, java.lang.String term, boolean strict)  
      static java.lang.String translateBundleString​(javax.swing.JComponent component, java.lang.String bundleKey, java.lang.Object... args)
      This function first attempts to locate the english version of the bundleKey, translate it through the client translation system, and then if unsuccessful, it will try to get the translation from bundleutil.
      static java.lang.String translateSimple​(java.lang.String term)  
      static java.lang.String translateTimeString​(javax.swing.JComponent component, java.lang.String time, java.lang.String dayKey, java.lang.String hourKey, java.lang.String minKey, java.lang.String secKey)
      Translates a Formatted Time String containing string literal time units delimited by either commas or spaces.
      • Methods inherited from class java.lang.Object

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

      • TranslationUtils

        public TranslationUtils()
    • Method Detail

      • isClientTranslationEnabled

        protected static boolean isClientTranslationEnabled()
      • getComponentTranslations

        public static MutableTranslationPackage getComponentTranslations​(javax.swing.JComponent comp,
                                                                         boolean createIfNecessary)
      • createComponentTranslations

        public static MutableTranslationPackage createComponentTranslations​(javax.swing.JComponent comp)
      • t

        public static java.lang.String t​(javax.swing.JComponent component,
                                         java.lang.String term)
        NOT FOR BUNDLE KEYS. Short form version of translate().
      • t

        public static java.lang.String t​(java.lang.String term)
        NOT FOR BUNDLE KEYS, and not for components. Short form of translate()
      • translate

        public static java.lang.String translate​(javax.swing.JComponent component,
                                                 java.lang.String term)
        This class returns the best translation available for the specified term in the provided component. It will first look for a translation package on the component, and then will go to the client localization manager.
        Parameters:
        term - generally the name of the property on the component, but may be more complex for more advanced term situations.
      • translate

        public static java.lang.String translate​(javax.swing.JComponent component,
                                                 java.lang.String term,
                                                 boolean strict)
      • translateSimple

        public static java.lang.String translateSimple​(java.lang.String term)
      • _t

        public static java.lang.String _t​(javax.swing.JComponent component,
                                          java.lang.String bundleKey,
                                          java.lang.Object... args)
        FOR BUNDLE KEYS. This is a short-form version of translateBundleString(). See that function for more information. In short, it translates a bundle key through the translation system if possible, otherwise going to the bundle system.
      • _t

        public static java.lang.String _t​(java.lang.String bundleKey,
                                          java.lang.Object... args)
        FOR BUNDLE KEYS NOT IN COMPONENTS. Any components that support local localization should use the other overload that accepts the component as a parameter. This version tries to get a translation for this term from the translation system if possible, and then goes to the bundle system.
      • translateBundleString

        public static java.lang.String translateBundleString​(javax.swing.JComponent component,
                                                             java.lang.String bundleKey,
                                                             java.lang.Object... args)
        This function first attempts to locate the english version of the bundleKey, translate it through the client translation system, and then if unsuccessful, it will try to get the translation from bundleutil.
      • isTranslatable

        public static boolean isTranslatable​(javax.swing.JComponent source)
      • getTranslatedDataset

        public static Dataset getTranslatedDataset​(Dataset ds,
                                                   int labelColumnIndex,
                                                   javax.swing.JComponent component)
      • getTranslatedDataset

        public static Dataset getTranslatedDataset​(Dataset ds,
                                                   int labelColumnIndex,
                                                   javax.swing.JComponent component,
                                                   boolean translateColumnNames)
      • translateTimeString

        public static java.lang.String translateTimeString​(javax.swing.JComponent component,
                                                           java.lang.String time,
                                                           java.lang.String dayKey,
                                                           java.lang.String hourKey,
                                                           java.lang.String minKey,
                                                           java.lang.String secKey)
        Translates a Formatted Time String containing string literal time units delimited by either commas or spaces. example: "23 minutes, 14 seconds" will be converted to active translation language equivalent.

        Possible (likely) this won't work for all locales/languages, should really only be used in situations where the string source is a Gateway generated English string, and other translation methods aren't available.

        Parameters:
        component - the Vision component that the bundlekeys are registered with
        time - the String which has English time units (days, hours, minutes or seconds) to be translated
        secKey - the BundleUtil bundlekeys for each respective property wanting to translate