Changeset 18296 for gli/branches/rtl-gli


Ignore:
Timestamp:
2008-12-26T14:32:56+13:00 (15 years ago)
Author:
kjdon
Message:

added getOrientation method for language orientation (rtl or ltr). USed by GUI components to setermine which way to display text. Thanks to Amin Hejazi

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gli/branches/rtl-gli/src/org/greenstone/gatherer/Dictionary.java

    r12295 r18296  
    3737package org.greenstone.gatherer;
    3838
     39import java.awt.ComponentOrientation;
    3940import javax.swing.plaf.FontUIResource;
    4041import java.util.HashMap;
     
    7475    Loaded from a file named "dictionary<I>locale</I>.properties. */
    7576    static private ResourceBundle dictionary = null;
    76 
    77 
     77    /** language orientation property */
     78    static private ComponentOrientation orientation = null;
     79       
    7880    public Dictionary(Locale locale, FontUIResource font)
    7981    {
     
    8486    this.locale = ((locale == null) ? Locale.getDefault() : locale);
    8587    this.dictionary = ResourceBundle.getBundle("dictionary", this.locale);
    86     }
    87 
    88 
     88        if (this.get("Component.Orientation").equals("RTL")){
     89            this.orientation = ComponentOrientation.RIGHT_TO_LEFT;
     90        } else {
     91            this.orientation = ComponentOrientation.LEFT_TO_RIGHT;
     92        }     
     93       
     94    }
     95   
    8996    /** Retrieve the two letter code of the current language we are using, according to the stored locale.
    9097     * @return A <strong>String</strong> containing the two letter ISO639 language code.
     
    94101    return locale.getLanguage();
    95102    }
    96 
    97 
     103    /** returns the Components Orientation for use with right to left languages
     104     * @return A <strong>ComponentOrientation</strong> with the current
     105     dictionary's language orientation.
     106     * by  Amin Hejazi
     107    */
     108    static public ComponentOrientation getOrientation()
     109    {
     110       return orientation;
     111    }
     112   
    98113    static public String get(String key)
    99114    {
    100115    return get(key, (String[]) null);
    101116    }
    102 
    103117
    104118    static public String get(String key, String arg)
Note: See TracChangeset for help on using the changeset viewer.